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( | 113 Scope* function_scope = NewScope(scope_, FUNCTION_SCOPE, kind); |
114 scope_, IsArrowFunction(kind) ? ARROW_SCOPE : FUNCTION_SCOPE, kind); | |
115 PreParserFactory function_factory(NULL); | 114 PreParserFactory function_factory(NULL); |
116 FunctionState function_state(&function_state_, &scope_, function_scope, kind, | 115 FunctionState function_state(&function_state_, &scope_, function_scope, kind, |
117 &function_factory); | 116 &function_factory); |
118 DCHECK_EQ(Token::LBRACE, scanner()->current_token()); | 117 DCHECK_EQ(Token::LBRACE, scanner()->current_token()); |
119 bool ok = true; | 118 bool ok = true; |
120 int start_position = peek_position(); | 119 int start_position = peek_position(); |
121 ParseLazyFunctionLiteralBody(&ok, bookmark); | 120 ParseLazyFunctionLiteralBody(&ok, bookmark); |
122 if (bookmark && bookmark->HasBeenReset()) { | 121 if (bookmark && bookmark->HasBeenReset()) { |
123 ; // Do nothing, as we've just aborted scanning this function. | 122 ; // Do nothing, as we've just aborted scanning this function. |
124 } else if (stack_overflow()) { | 123 } else if (stack_overflow()) { |
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 | 1186 |
1188 DCHECK(!spread_pos.IsValid()); | 1187 DCHECK(!spread_pos.IsValid()); |
1189 | 1188 |
1190 return Expression::Default(); | 1189 return Expression::Default(); |
1191 } | 1190 } |
1192 | 1191 |
1193 #undef CHECK_OK | 1192 #undef CHECK_OK |
1194 | 1193 |
1195 | 1194 |
1196 } } // v8::internal | 1195 } } // v8::internal |
OLD | NEW |