Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: runtime/vm/scanner.cc

Issue 1925413003: Do not add a private identifier twice into the symbol table, once without the private key appended … (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/scanner.h" 5 #include "vm/scanner.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/dart.h" 8 #include "vm/dart.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 current_token_.kind = keywords_[i].kind; 322 current_token_.kind = keywords_[i].kind;
323 return; 323 return;
324 } 324 }
325 } 325 }
326 i++; 326 i++;
327 } 327 }
328 } 328 }
329 329
330 // We did not read a keyword. 330 // We did not read a keyword.
331 current_token_.kind = Token::kIDENT; 331 current_token_.kind = Token::kIDENT;
332 String& literal = 332 String& literal = String::ZoneHandle(Z);
333 String::ZoneHandle(Z, Symbols::New(T, source_, ident_pos, ident_length));
334 if (ident_char0 == Library::kPrivateIdentifierStart) { 333 if (ident_char0 == Library::kPrivateIdentifierStart) {
335 // Private identifiers are mangled on a per library basis. 334 // Private identifiers are mangled on a per library basis.
335 literal = String::SubString(source_, ident_pos, ident_length);
336 literal = Symbols::FromConcat(T, literal, private_key_); 336 literal = Symbols::FromConcat(T, literal, private_key_);
337 } else {
338 literal = Symbols::New(T, source_, ident_pos, ident_length);
337 } 339 }
338 current_token_.literal = &literal; 340 current_token_.literal = &literal;
339 } 341 }
340 342
341 343
342 // Parse integer or double number literal of format: 344 // Parse integer or double number literal of format:
343 // NUMBER = INTEGER | DOUBLE 345 // NUMBER = INTEGER | DOUBLE
344 // INTEGER = D+ | (("0x" | "0X") H+) 346 // INTEGER = D+ | (("0x" | "0X") H+)
345 // DOUBLE = ((D+ ["." D*]) | ("." D+)) [ EXPONENT ] 347 // DOUBLE = ((D+ ["." D*]) | ("." D+)) [ EXPONENT ]
346 // EXPONENT = ("e" | "E") ["+" | "-"] D+ 348 // EXPONENT = ("e" | "E") ["+" | "-"] D+
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 keywords_[i].keyword_symbol = &Symbols::Token(token); 978 keywords_[i].keyword_symbol = &Symbols::Token(token);
977 979
978 int ch = keywords_[i].keyword_chars[0] - 'a'; 980 int ch = keywords_[i].keyword_chars[0] - 'a';
979 if (keywords_char_offset_[ch] == Token::kNumKeywords) { 981 if (keywords_char_offset_[ch] == Token::kNumKeywords) {
980 keywords_char_offset_[ch] = i; 982 keywords_char_offset_[ch] = i;
981 } 983 }
982 } 984 }
983 } 985 }
984 986
985 } // namespace dart 987 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698