| OLD | NEW |
| 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/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/ast/ast-expression-rewriter.h" | 10 #include "src/ast/ast-expression-rewriter.h" |
| (...skipping 2000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2011 Expect(Token::COMMA, CHECK_OK); | 2011 Expect(Token::COMMA, CHECK_OK); |
| 2012 } | 2012 } |
| 2013 } | 2013 } |
| 2014 Expect(Token::RPAREN, CHECK_OK); | 2014 Expect(Token::RPAREN, CHECK_OK); |
| 2015 Expect(Token::SEMICOLON, CHECK_OK); | 2015 Expect(Token::SEMICOLON, CHECK_OK); |
| 2016 | 2016 |
| 2017 // Make sure that the function containing the native declaration | 2017 // Make sure that the function containing the native declaration |
| 2018 // isn't lazily compiled. The extension structures are only | 2018 // isn't lazily compiled. The extension structures are only |
| 2019 // accessible while parsing the first time not when reparsing | 2019 // accessible while parsing the first time not when reparsing |
| 2020 // because of lazy compilation. | 2020 // because of lazy compilation. |
| 2021 // TODO(adamk): Should this be GetClosureScope()? | 2021 GetClosureScope()->ForceEagerCompilation(); |
| 2022 GetDeclarationScope()->ForceEagerCompilation(); | |
| 2023 | 2022 |
| 2024 // TODO(1240846): It's weird that native function declarations are | 2023 // TODO(1240846): It's weird that native function declarations are |
| 2025 // introduced dynamically when we meet their declarations, whereas | 2024 // introduced dynamically when we meet their declarations, whereas |
| 2026 // other functions are set up when entering the surrounding scope. | 2025 // other functions are set up when entering the surrounding scope. |
| 2027 Declaration* decl = DeclareVariable(name, VAR, pos, CHECK_OK); | 2026 Declaration* decl = DeclareVariable(name, VAR, pos, CHECK_OK); |
| 2028 NativeFunctionLiteral* lit = | 2027 NativeFunctionLiteral* lit = |
| 2029 factory()->NewNativeFunctionLiteral(name, extension_, kNoSourcePosition); | 2028 factory()->NewNativeFunctionLiteral(name, extension_, kNoSourcePosition); |
| 2030 return factory()->NewExpressionStatement( | 2029 return factory()->NewExpressionStatement( |
| 2031 factory()->NewAssignment(Token::INIT, decl->proxy(), lit, | 2030 factory()->NewAssignment(Token::INIT, decl->proxy(), lit, |
| 2032 kNoSourcePosition), | 2031 kNoSourcePosition), |
| (...skipping 2980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5013 Scanner::Location spread_pos; | 5012 Scanner::Location spread_pos; |
| 5014 ExpressionClassifier classifier(this); | 5013 ExpressionClassifier classifier(this); |
| 5015 ZoneList<Expression*>* args = | 5014 ZoneList<Expression*>* args = |
| 5016 ParseArguments(&spread_pos, &classifier, CHECK_OK); | 5015 ParseArguments(&spread_pos, &classifier, CHECK_OK); |
| 5017 | 5016 |
| 5018 DCHECK(!spread_pos.IsValid()); | 5017 DCHECK(!spread_pos.IsValid()); |
| 5019 | 5018 |
| 5020 if (extension_ != NULL) { | 5019 if (extension_ != NULL) { |
| 5021 // The extension structures are only accessible while parsing the | 5020 // The extension structures are only accessible while parsing the |
| 5022 // very first time not when reparsing because of lazy compilation. | 5021 // very first time not when reparsing because of lazy compilation. |
| 5023 GetDeclarationScope()->ForceEagerCompilation(); | 5022 GetClosureScope()->ForceEagerCompilation(); |
| 5024 } | 5023 } |
| 5025 | 5024 |
| 5026 const Runtime::Function* function = Runtime::FunctionForName(name->string()); | 5025 const Runtime::Function* function = Runtime::FunctionForName(name->string()); |
| 5027 | 5026 |
| 5028 if (function != NULL) { | 5027 if (function != NULL) { |
| 5029 // Check for possible name clash. | 5028 // Check for possible name clash. |
| 5030 DCHECK_EQ(Context::kNotFound, | 5029 DCHECK_EQ(Context::kNotFound, |
| 5031 Context::IntrinsicIndexForName(name->string())); | 5030 Context::IntrinsicIndexForName(name->string())); |
| 5032 // Check for built-in IS_VAR macro. | 5031 // Check for built-in IS_VAR macro. |
| 5033 if (function->function_id == Runtime::kIS_VAR) { | 5032 if (function->function_id == Runtime::kIS_VAR) { |
| (...skipping 1900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6934 node->Print(Isolate::Current()); | 6933 node->Print(Isolate::Current()); |
| 6935 } | 6934 } |
| 6936 #endif // DEBUG | 6935 #endif // DEBUG |
| 6937 | 6936 |
| 6938 #undef CHECK_OK | 6937 #undef CHECK_OK |
| 6939 #undef CHECK_OK_VOID | 6938 #undef CHECK_OK_VOID |
| 6940 #undef CHECK_FAILED | 6939 #undef CHECK_FAILED |
| 6941 | 6940 |
| 6942 } // namespace internal | 6941 } // namespace internal |
| 6943 } // namespace v8 | 6942 } // namespace v8 |
| OLD | NEW |