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

Side by Side Diff: src/parsing/parser.cc

Issue 1969203004: Add UseCounter for decimal with leading zero. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.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 | « include/v8.h ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/parsing/parser.h" 5 #include "src/parsing/parser.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/ast-expression-rewriter.h" 9 #include "src/ast/ast-expression-rewriter.h"
10 #include "src/ast/ast-expression-visitor.h" 10 #include "src/ast/ast-expression-visitor.h"
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 scope_->SetLanguageMode(info->language_mode()); 936 scope_->SetLanguageMode(info->language_mode());
937 ParseStatementList(body, Token::EOS, &ok); 937 ParseStatementList(body, Token::EOS, &ok);
938 } 938 }
939 939
940 // The parser will peek but not consume EOS. Our scope logically goes all 940 // The parser will peek but not consume EOS. Our scope logically goes all
941 // the way to the EOS, though. 941 // the way to the EOS, though.
942 scope->set_end_position(scanner()->peek_location().beg_pos); 942 scope->set_end_position(scanner()->peek_location().beg_pos);
943 943
944 if (ok && is_strict(language_mode())) { 944 if (ok && is_strict(language_mode())) {
945 CheckStrictOctalLiteral(beg_pos, scanner()->location().end_pos, &ok); 945 CheckStrictOctalLiteral(beg_pos, scanner()->location().end_pos, &ok);
946 CheckDecimalLiteralWithLeadingZero(use_counts_, beg_pos,
947 scanner()->location().end_pos);
946 } 948 }
947 if (ok && is_sloppy(language_mode())) { 949 if (ok && is_sloppy(language_mode())) {
948 // TODO(littledan): Function bindings on the global object that modify 950 // TODO(littledan): Function bindings on the global object that modify
949 // pre-existing bindings should be made writable, enumerable and 951 // pre-existing bindings should be made writable, enumerable and
950 // nonconfigurable if possible, whereas this code will leave attributes 952 // nonconfigurable if possible, whereas this code will leave attributes
951 // unchanged if the property already exists. 953 // unchanged if the property already exists.
952 InsertSloppyBlockFunctionVarBindings(scope, &ok); 954 InsertSloppyBlockFunctionVarBindings(scope, &ok);
953 } 955 }
954 if (ok) { 956 if (ok) {
955 CheckConflictingVarDeclarations(scope_, &ok); 957 CheckConflictingVarDeclarations(scope_, &ok);
(...skipping 3213 matching lines...) Expand 10 before | Expand all | Expand 10 after
4169 CheckFunctionName(language_mode, function_name, function_name_validity, 4171 CheckFunctionName(language_mode, function_name, function_name_validity,
4170 function_name_location, CHECK_OK); 4172 function_name_location, CHECK_OK);
4171 const bool allow_duplicate_parameters = 4173 const bool allow_duplicate_parameters =
4172 is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind); 4174 is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind);
4173 ValidateFormalParameters(&formals_classifier, language_mode, 4175 ValidateFormalParameters(&formals_classifier, language_mode,
4174 allow_duplicate_parameters, CHECK_OK); 4176 allow_duplicate_parameters, CHECK_OK);
4175 4177
4176 if (is_strict(language_mode)) { 4178 if (is_strict(language_mode)) {
4177 CheckStrictOctalLiteral(scope->start_position(), scope->end_position(), 4179 CheckStrictOctalLiteral(scope->start_position(), scope->end_position(),
4178 CHECK_OK); 4180 CHECK_OK);
4181 CheckDecimalLiteralWithLeadingZero(use_counts_, scope->start_position(),
4182 scope->end_position());
4179 } 4183 }
4180 if (is_sloppy(language_mode)) { 4184 if (is_sloppy(language_mode)) {
4181 InsertSloppyBlockFunctionVarBindings(scope, CHECK_OK); 4185 InsertSloppyBlockFunctionVarBindings(scope, CHECK_OK);
4182 } 4186 }
4183 CheckConflictingVarDeclarations(scope, CHECK_OK); 4187 CheckConflictingVarDeclarations(scope, CHECK_OK);
4184 4188
4185 if (body) { 4189 if (body) {
4186 // If body can be inspected, rewrite queued destructuring assignments 4190 // If body can be inspected, rewrite queued destructuring assignments
4187 ParserTraits::RewriteDestructuringAssignments(); 4191 ParserTraits::RewriteDestructuringAssignments();
4188 } 4192 }
(...skipping 2628 matching lines...) Expand 10 before | Expand all | Expand 10 after
6817 try_block, target); 6821 try_block, target);
6818 final_loop = target; 6822 final_loop = target;
6819 } 6823 }
6820 6824
6821 return final_loop; 6825 return final_loop;
6822 } 6826 }
6823 6827
6824 6828
6825 } // namespace internal 6829 } // namespace internal
6826 } // namespace v8 6830 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698