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

Side by Side Diff: src/parser.cc

Issue 1376623002: Extend Annex B 3.3 sloppy-mode block-scoped hoisting to scripts, eval (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: An additional test Created 5 years, 2 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 | test/mjsunit/harmony/block-sloppy-function.js » ('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/parser.h" 5 #include "src/parser.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/ast-literal-reindexer.h" 9 #include "src/ast-literal-reindexer.h"
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 ParseStatementList(body, Token::EOS, &ok); 1059 ParseStatementList(body, Token::EOS, &ok);
1060 } 1060 }
1061 1061
1062 // The parser will peek but not consume EOS. Our scope logically goes all 1062 // The parser will peek but not consume EOS. Our scope logically goes all
1063 // the way to the EOS, though. 1063 // the way to the EOS, though.
1064 scope->set_end_position(scanner()->peek_location().beg_pos); 1064 scope->set_end_position(scanner()->peek_location().beg_pos);
1065 1065
1066 if (ok && is_strict(language_mode())) { 1066 if (ok && is_strict(language_mode())) {
1067 CheckStrictOctalLiteral(beg_pos, scanner()->location().end_pos, &ok); 1067 CheckStrictOctalLiteral(beg_pos, scanner()->location().end_pos, &ok);
1068 } 1068 }
1069 if (ok && is_sloppy(language_mode()) && allow_harmony_sloppy_function()) {
1070 // TODO(littledan): Function bindings on the global object that modify
1071 // pre-existing bindings should be made writable, enumerable and
1072 // nonconfigurable if possible, whereas this code will leave attributes
1073 // unchanged if the property already exists.
1074 InsertSloppyBlockFunctionVarBindings(scope, &ok);
1075 }
1069 if (ok && (is_strict(language_mode()) || allow_harmony_sloppy())) { 1076 if (ok && (is_strict(language_mode()) || allow_harmony_sloppy())) {
1070 CheckConflictingVarDeclarations(scope_, &ok); 1077 CheckConflictingVarDeclarations(scope_, &ok);
1071 } 1078 }
1072 1079
1073 if (ok && info->parse_restriction() == ONLY_SINGLE_FUNCTION_LITERAL) { 1080 if (ok && info->parse_restriction() == ONLY_SINGLE_FUNCTION_LITERAL) {
1074 if (body->length() != 1 || 1081 if (body->length() != 1 ||
1075 !body->at(0)->IsExpressionStatement() || 1082 !body->at(0)->IsExpressionStatement() ||
1076 !body->at(0)->AsExpressionStatement()-> 1083 !body->at(0)->AsExpressionStatement()->
1077 expression()->IsFunctionLiteral()) { 1084 expression()->IsFunctionLiteral()) {
1078 ReportMessage(MessageTemplate::kSingleFunctionLiteral); 1085 ReportMessage(MessageTemplate::kSingleFunctionLiteral);
(...skipping 5208 matching lines...) Expand 10 before | Expand all | Expand 10 after
6287 6294
6288 Expression* Parser::SpreadCallNew(Expression* function, 6295 Expression* Parser::SpreadCallNew(Expression* function,
6289 ZoneList<v8::internal::Expression*>* args, 6296 ZoneList<v8::internal::Expression*>* args,
6290 int pos) { 6297 int pos) {
6291 args->InsertAt(0, function, zone()); 6298 args->InsertAt(0, function, zone());
6292 6299
6293 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); 6300 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos);
6294 } 6301 }
6295 } // namespace internal 6302 } // namespace internal
6296 } // namespace v8 6303 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/harmony/block-sloppy-function.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698