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

Side by Side Diff: src/preparser.cc

Issue 1386253002: Use Scope::function_kind_ to distinguish arrow function scopes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 <cmath> 5 #include <cmath>
6 6
7 #include "src/allocation.h" 7 #include "src/allocation.h"
8 #include "src/base/logging.h" 8 #include "src/base/logging.h"
9 #include "src/conversions-inl.h" 9 #include "src/conversions-inl.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 PreParser::PreParseResult PreParser::PreParseLazyFunction( 104 PreParser::PreParseResult PreParser::PreParseLazyFunction(
105 LanguageMode language_mode, FunctionKind kind, bool has_simple_parameters, 105 LanguageMode language_mode, FunctionKind kind, bool has_simple_parameters,
106 ParserRecorder* log, Scanner::BookmarkScope* bookmark) { 106 ParserRecorder* log, Scanner::BookmarkScope* bookmark) {
107 log_ = log; 107 log_ = log;
108 // Lazy functions always have trivial outer scopes (no with/catch scopes). 108 // Lazy functions always have trivial outer scopes (no with/catch scopes).
109 Scope* top_scope = NewScope(scope_, SCRIPT_SCOPE); 109 Scope* top_scope = NewScope(scope_, SCRIPT_SCOPE);
110 PreParserFactory top_factory(NULL); 110 PreParserFactory top_factory(NULL);
111 FunctionState top_state(&function_state_, &scope_, top_scope, kNormalFunction, 111 FunctionState top_state(&function_state_, &scope_, top_scope, kNormalFunction,
112 &top_factory); 112 &top_factory);
113 scope_->SetLanguageMode(language_mode); 113 scope_->SetLanguageMode(language_mode);
114 Scope* function_scope = NewScope( 114 Scope* function_scope = NewScope(scope_, FUNCTION_SCOPE, kind);
115 scope_, IsArrowFunction(kind) ? ARROW_SCOPE : FUNCTION_SCOPE, kind);
116 if (!has_simple_parameters) function_scope->SetHasNonSimpleParameters(); 115 if (!has_simple_parameters) function_scope->SetHasNonSimpleParameters();
117 PreParserFactory function_factory(NULL); 116 PreParserFactory function_factory(NULL);
118 FunctionState function_state(&function_state_, &scope_, function_scope, kind, 117 FunctionState function_state(&function_state_, &scope_, function_scope, kind,
119 &function_factory); 118 &function_factory);
120 DCHECK_EQ(Token::LBRACE, scanner()->current_token()); 119 DCHECK_EQ(Token::LBRACE, scanner()->current_token());
121 bool ok = true; 120 bool ok = true;
122 int start_position = peek_position(); 121 int start_position = peek_position();
123 ParseLazyFunctionLiteralBody(&ok, bookmark); 122 ParseLazyFunctionLiteralBody(&ok, bookmark);
124 if (bookmark && bookmark->HasBeenReset()) { 123 if (bookmark && bookmark->HasBeenReset()) {
125 // Do nothing, as we've just aborted scanning this function. 124 // Do nothing, as we've just aborted scanning this function.
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 DCHECK(!spread_pos.IsValid()); 1237 DCHECK(!spread_pos.IsValid());
1239 1238
1240 return Expression::Default(); 1239 return Expression::Default();
1241 } 1240 }
1242 1241
1243 #undef CHECK_OK 1242 #undef CHECK_OK
1244 1243
1245 1244
1246 } // namespace internal 1245 } // namespace internal
1247 } // namespace v8 1246 } // namespace v8
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | src/scopeinfo.cc » ('j') | test/mjsunit/es6/regress/regress-4466.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698