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

Side by Side Diff: src/parser.cc

Issue 812163003: Simplify scanner and generate better error message for legacy octals in templates (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase it Created 6 years 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 | « src/messages.js ('k') | src/preparser.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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast.h" 8 #include "src/ast.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 &function_factory); 929 &function_factory);
930 930
931 scope_->SetStrictMode(info->strict_mode()); 931 scope_->SetStrictMode(info->strict_mode());
932 ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(16, zone()); 932 ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(16, zone());
933 bool ok = true; 933 bool ok = true;
934 int beg_pos = scanner()->location().beg_pos; 934 int beg_pos = scanner()->location().beg_pos;
935 ParseSourceElements(body, Token::EOS, info->is_eval(), true, eval_scope, 935 ParseSourceElements(body, Token::EOS, info->is_eval(), true, eval_scope,
936 &ok); 936 &ok);
937 937
938 if (ok && strict_mode() == STRICT) { 938 if (ok && strict_mode() == STRICT) {
939 CheckOctalLiteral(beg_pos, scanner()->location().end_pos, &ok); 939 CheckStrictOctalLiteral(beg_pos, scanner()->location().end_pos, &ok);
940 } 940 }
941 941
942 if (ok && allow_harmony_scoping() && strict_mode() == STRICT) { 942 if (ok && allow_harmony_scoping() && strict_mode() == STRICT) {
943 CheckConflictingVarDeclarations(scope_, &ok); 943 CheckConflictingVarDeclarations(scope_, &ok);
944 } 944 }
945 945
946 if (ok && info->parse_restriction() == ONLY_SINGLE_FUNCTION_LITERAL) { 946 if (ok && info->parse_restriction() == ONLY_SINGLE_FUNCTION_LITERAL) {
947 if (body->length() != 1 || 947 if (body->length() != 1 ||
948 !body->at(0)->IsExpressionStatement() || 948 !body->at(0)->IsExpressionStatement() ||
949 !body->at(0)->AsExpressionStatement()-> 949 !body->at(0)->AsExpressionStatement()->
(...skipping 2846 matching lines...) Expand 10 before | Expand all | Expand 10 after
3796 if (strict_mode() == STRICT || IsConciseMethod(kind)) { 3796 if (strict_mode() == STRICT || IsConciseMethod(kind)) {
3797 CheckStrictFunctionNameAndParameters(function_name, 3797 CheckStrictFunctionNameAndParameters(function_name,
3798 name_is_strict_reserved, 3798 name_is_strict_reserved,
3799 function_name_location, 3799 function_name_location,
3800 eval_args_error_log, 3800 eval_args_error_log,
3801 dupe_error_loc, 3801 dupe_error_loc,
3802 reserved_loc, 3802 reserved_loc,
3803 CHECK_OK); 3803 CHECK_OK);
3804 } 3804 }
3805 if (strict_mode() == STRICT) { 3805 if (strict_mode() == STRICT) {
3806 CheckOctalLiteral(scope->start_position(), 3806 CheckStrictOctalLiteral(scope->start_position(), scope->end_position(),
3807 scope->end_position(), 3807 CHECK_OK);
3808 CHECK_OK);
3809 } 3808 }
3810 if (allow_harmony_scoping() && strict_mode() == STRICT) { 3809 if (allow_harmony_scoping() && strict_mode() == STRICT) {
3811 CheckConflictingVarDeclarations(scope, CHECK_OK); 3810 CheckConflictingVarDeclarations(scope, CHECK_OK);
3812 } 3811 }
3813 } 3812 }
3814 3813
3815 FunctionLiteral* function_literal = factory()->NewFunctionLiteral( 3814 FunctionLiteral* function_literal = factory()->NewFunctionLiteral(
3816 function_name, ast_value_factory(), scope, body, 3815 function_name, ast_value_factory(), scope, body,
3817 materialized_literal_count, expected_property_count, handler_count, 3816 materialized_literal_count, expected_property_count, handler_count,
3818 num_parameters, duplicate_parameters, function_type, 3817 num_parameters, duplicate_parameters, function_type,
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after
5294 } else { 5293 } else {
5295 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); 5294 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data());
5296 running_hash = StringHasher::ComputeRunningHash(running_hash, data, 5295 running_hash = StringHasher::ComputeRunningHash(running_hash, data,
5297 raw_string->length()); 5296 raw_string->length());
5298 } 5297 }
5299 } 5298 }
5300 5299
5301 return running_hash; 5300 return running_hash;
5302 } 5301 }
5303 } } // namespace v8::internal 5302 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/messages.js ('k') | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698