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

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: Tests, many of which fail 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
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 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 ParseStatementList(body, Token::EOS, &ok); 1060 ParseStatementList(body, Token::EOS, &ok);
1061 } 1061 }
1062 1062
1063 // The parser will peek but not consume EOS. Our scope logically goes all 1063 // The parser will peek but not consume EOS. Our scope logically goes all
1064 // the way to the EOS, though. 1064 // the way to the EOS, though.
1065 scope->set_end_position(scanner()->peek_location().beg_pos); 1065 scope->set_end_position(scanner()->peek_location().beg_pos);
1066 1066
1067 if (ok && is_strict(language_mode())) { 1067 if (ok && is_strict(language_mode())) {
1068 CheckStrictOctalLiteral(beg_pos, scanner()->location().end_pos, &ok); 1068 CheckStrictOctalLiteral(beg_pos, scanner()->location().end_pos, &ok);
1069 } 1069 }
1070 if (ok && is_sloppy(language_mode()) && allow_harmony_sloppy_function()) {
1071 // TODO(littledan): Function bindings on the global object that modify
1072 // pre-existing bindings should be made writable, enumerable and
1073 // nonconfigurable if possible, whereas this code will leave attributes
1074 // unchanged if the property already exists.
1075 InsertSloppyBlockFunctionVarBindings(scope, &ok);
1076 }
1070 if (ok && (is_strict(language_mode()) || allow_harmony_sloppy())) { 1077 if (ok && (is_strict(language_mode()) || allow_harmony_sloppy())) {
1071 CheckConflictingVarDeclarations(scope_, &ok); 1078 CheckConflictingVarDeclarations(scope_, &ok);
1072 } 1079 }
1073 1080
1074 if (ok && info->parse_restriction() == ONLY_SINGLE_FUNCTION_LITERAL) { 1081 if (ok && info->parse_restriction() == ONLY_SINGLE_FUNCTION_LITERAL) {
1075 if (body->length() != 1 || 1082 if (body->length() != 1 ||
1076 !body->at(0)->IsExpressionStatement() || 1083 !body->at(0)->IsExpressionStatement() ||
1077 !body->at(0)->AsExpressionStatement()-> 1084 !body->at(0)->AsExpressionStatement()->
1078 expression()->IsFunctionLiteral()) { 1085 expression()->IsFunctionLiteral()) {
1079 ReportMessage(MessageTemplate::kSingleFunctionLiteral); 1086 ReportMessage(MessageTemplate::kSingleFunctionLiteral);
(...skipping 5209 matching lines...) Expand 10 before | Expand all | Expand 10 after
6289 6296
6290 Expression* Parser::SpreadCallNew(Expression* function, 6297 Expression* Parser::SpreadCallNew(Expression* function,
6291 ZoneList<v8::internal::Expression*>* args, 6298 ZoneList<v8::internal::Expression*>* args,
6292 int pos) { 6299 int pos) {
6293 args->InsertAt(0, function, zone()); 6300 args->InsertAt(0, function, zone());
6294 6301
6295 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); 6302 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos);
6296 } 6303 }
6297 } // namespace internal 6304 } // namespace internal
6298 } // namespace v8 6305 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/harmony/block-sloppy-function.js » ('j') | test/mjsunit/harmony/block-sloppy-function.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698