OLD | NEW |
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 PreParser::PreParseResult PreParser::PreParseLazyFunction( | 103 PreParser::PreParseResult PreParser::PreParseLazyFunction( |
104 LanguageMode language_mode, FunctionKind kind, ParserRecorder* log, | 104 LanguageMode language_mode, FunctionKind kind, ParserRecorder* log, |
105 Scanner::BookmarkScope* bookmark) { | 105 Scanner::BookmarkScope* bookmark) { |
106 log_ = log; | 106 log_ = log; |
107 // Lazy functions always have trivial outer scopes (no with/catch scopes). | 107 // Lazy functions always have trivial outer scopes (no with/catch scopes). |
108 Scope* top_scope = NewScope(scope_, SCRIPT_SCOPE); | 108 Scope* top_scope = NewScope(scope_, SCRIPT_SCOPE); |
109 PreParserFactory top_factory(NULL); | 109 PreParserFactory top_factory(NULL); |
110 FunctionState top_state(&function_state_, &scope_, top_scope, kNormalFunction, | 110 FunctionState top_state(&function_state_, &scope_, top_scope, kNormalFunction, |
111 &top_factory); | 111 &top_factory); |
112 scope_->SetLanguageMode(language_mode); | 112 scope_->SetLanguageMode(language_mode); |
113 Scope* function_scope = NewScope(scope_, FUNCTION_SCOPE, kind); | 113 Scope* function_scope = NewScope( |
| 114 scope_, IsArrowFunction(kind) ? ARROW_SCOPE : FUNCTION_SCOPE, kind); |
114 PreParserFactory function_factory(NULL); | 115 PreParserFactory function_factory(NULL); |
115 FunctionState function_state(&function_state_, &scope_, function_scope, kind, | 116 FunctionState function_state(&function_state_, &scope_, function_scope, kind, |
116 &function_factory); | 117 &function_factory); |
117 DCHECK_EQ(Token::LBRACE, scanner()->current_token()); | 118 DCHECK_EQ(Token::LBRACE, scanner()->current_token()); |
118 bool ok = true; | 119 bool ok = true; |
119 int start_position = peek_position(); | 120 int start_position = peek_position(); |
120 ParseLazyFunctionLiteralBody(&ok, bookmark); | 121 ParseLazyFunctionLiteralBody(&ok, bookmark); |
121 if (bookmark && bookmark->HasBeenReset()) { | 122 if (bookmark && bookmark->HasBeenReset()) { |
122 ; // Do nothing, as we've just aborted scanning this function. | 123 ; // Do nothing, as we've just aborted scanning this function. |
123 } else if (stack_overflow()) { | 124 } else if (stack_overflow()) { |
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 | 1187 |
1187 DCHECK(!spread_pos.IsValid()); | 1188 DCHECK(!spread_pos.IsValid()); |
1188 | 1189 |
1189 return Expression::Default(); | 1190 return Expression::Default(); |
1190 } | 1191 } |
1191 | 1192 |
1192 #undef CHECK_OK | 1193 #undef CHECK_OK |
1193 | 1194 |
1194 | 1195 |
1195 } } // v8::internal | 1196 } } // v8::internal |
OLD | NEW |