From 918dbd4551f6c737d1c4b7416ef40b59c902eac8 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 10 Mar 2019 15:55:38 -0400 Subject: [PATCH] std.zig: `this` is no longer a keyword --- doc/docgen.zig | 1 - src-self-hosted/ir.zig | 1 - std/zig/ast.zig | 18 ------------------ std/zig/parse.zig | 4 ---- std/zig/render.zig | 4 ---- std/zig/tokenizer.zig | 2 -- 6 files changed, 30 deletions(-) diff --git a/doc/docgen.zig b/doc/docgen.zig index 9ae3492841..880808de90 100644 --- a/doc/docgen.zig +++ b/doc/docgen.zig @@ -795,7 +795,6 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: var, source_token: Tok std.zig.Token.Id.Keyword_null, std.zig.Token.Id.Keyword_true, std.zig.Token.Id.Keyword_false, - std.zig.Token.Id.Keyword_this, => { try out.write(""); try writeEscaped(out, src[token.start..token.end]); diff --git a/src-self-hosted/ir.zig b/src-self-hosted/ir.zig index dc1b0dc943..b184a1bfee 100644 --- a/src-self-hosted/ir.zig +++ b/src-self-hosted/ir.zig @@ -1151,7 +1151,6 @@ pub const Builder = struct { ast.Node.Id.BoolLiteral => return error.Unimplemented, ast.Node.Id.NullLiteral => return error.Unimplemented, ast.Node.Id.UndefinedLiteral => return error.Unimplemented, - ast.Node.Id.ThisLiteral => return error.Unimplemented, ast.Node.Id.Unreachable => return error.Unimplemented, ast.Node.Id.Identifier => { const identifier = @fieldParentPtr(ast.Node.Identifier, "base", node); diff --git a/std/zig/ast.zig b/std/zig/ast.zig index 421c657619..77daeb16e1 100644 --- a/std/zig/ast.zig +++ b/std/zig/ast.zig @@ -302,7 +302,6 @@ pub const Node = struct { BoolLiteral, NullLiteral, UndefinedLiteral, - ThisLiteral, Unreachable, Identifier, GroupedExpression, @@ -1997,23 +1996,6 @@ pub const Node = struct { } }; - pub const ThisLiteral = struct { - base: Node, - token: TokenIndex, - - pub fn iterate(self: *ThisLiteral, index: usize) ?*Node { - return null; - } - - pub fn firstToken(self: *const ThisLiteral) TokenIndex { - return self.token; - } - - pub fn lastToken(self: *const ThisLiteral) TokenIndex { - return self.token; - } - }; - pub const AsmOutput = struct { base: Node, lbracket: TokenIndex, diff --git a/std/zig/parse.zig b/std/zig/parse.zig index e957d1d3e1..7ab656413f 100644 --- a/std/zig/parse.zig +++ b/std/zig/parse.zig @@ -2563,10 +2563,6 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { _ = try createToCtxLiteral(arena, opt_ctx, ast.Node.NullLiteral, token.index); continue; }, - Token.Id.Keyword_this => { - _ = try createToCtxLiteral(arena, opt_ctx, ast.Node.ThisLiteral, token.index); - continue; - }, Token.Id.Keyword_var => { _ = try createToCtxLiteral(arena, opt_ctx, ast.Node.VarType, token.index); continue; diff --git a/std/zig/render.zig b/std/zig/render.zig index 50e928c0d8..3adf67c23b 100644 --- a/std/zig/render.zig +++ b/std/zig/render.zig @@ -880,10 +880,6 @@ fn renderExpression( const null_literal = @fieldParentPtr(ast.Node.NullLiteral, "base", base); return renderToken(tree, stream, null_literal.token, indent, start_col, space); }, - ast.Node.Id.ThisLiteral => { - const this_literal = @fieldParentPtr(ast.Node.ThisLiteral, "base", base); - return renderToken(tree, stream, this_literal.token, indent, start_col, space); - }, ast.Node.Id.Unreachable => { const unreachable_node = @fieldParentPtr(ast.Node.Unreachable, "base", base); return renderToken(tree, stream, unreachable_node.token, indent, start_col, space); diff --git a/std/zig/tokenizer.zig b/std/zig/tokenizer.zig index 79fd1c5612..2159371ccf 100644 --- a/std/zig/tokenizer.zig +++ b/std/zig/tokenizer.zig @@ -52,7 +52,6 @@ pub const Token = struct { Keyword{ .bytes = "suspend", .id = Id.Keyword_suspend }, Keyword{ .bytes = "switch", .id = Id.Keyword_switch }, Keyword{ .bytes = "test", .id = Id.Keyword_test }, - Keyword{ .bytes = "this", .id = Id.Keyword_this }, Keyword{ .bytes = "threadlocal", .id = Id.Keyword_threadlocal }, Keyword{ .bytes = "true", .id = Id.Keyword_true }, Keyword{ .bytes = "try", .id = Id.Keyword_try }, @@ -183,7 +182,6 @@ pub const Token = struct { Keyword_suspend, Keyword_switch, Keyword_test, - Keyword_this, Keyword_threadlocal, Keyword_true, Keyword_try,