| 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/v8.h" | 5 #include "src/v8.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 2181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2192 // 'function' Identifier '(' FormalParameterListopt ')' '{' FunctionBody '}' | 2192 // 'function' Identifier '(' FormalParameterListopt ')' '{' FunctionBody '}' |
| 2193 // GeneratorDeclaration :: | 2193 // GeneratorDeclaration :: |
| 2194 // 'function' '*' Identifier '(' FormalParameterListopt ')' | 2194 // 'function' '*' Identifier '(' FormalParameterListopt ')' |
| 2195 // '{' FunctionBody '}' | 2195 // '{' FunctionBody '}' |
| 2196 Expect(Token::FUNCTION, CHECK_OK); | 2196 Expect(Token::FUNCTION, CHECK_OK); |
| 2197 int pos = position(); | 2197 int pos = position(); |
| 2198 bool is_generator = Check(Token::MUL); | 2198 bool is_generator = Check(Token::MUL); |
| 2199 bool is_strict_reserved = false; | 2199 bool is_strict_reserved = false; |
| 2200 const AstRawString* name = ParseIdentifierOrStrictReservedWord( | 2200 const AstRawString* name = ParseIdentifierOrStrictReservedWord( |
| 2201 &is_strict_reserved, CHECK_OK); | 2201 &is_strict_reserved, CHECK_OK); |
| 2202 |
| 2203 if (fni_ != NULL) { |
| 2204 fni_->Enter(); |
| 2205 fni_->PushEnclosingName(name); |
| 2206 } |
| 2202 FunctionLiteral* fun = ParseFunctionLiteral( | 2207 FunctionLiteral* fun = ParseFunctionLiteral( |
| 2203 name, scanner()->location(), | 2208 name, scanner()->location(), |
| 2204 is_strict_reserved ? kFunctionNameIsStrictReserved | 2209 is_strict_reserved ? kFunctionNameIsStrictReserved |
| 2205 : kFunctionNameValidityUnknown, | 2210 : kFunctionNameValidityUnknown, |
| 2206 is_generator ? FunctionKind::kGeneratorFunction | 2211 is_generator ? FunctionKind::kGeneratorFunction |
| 2207 : FunctionKind::kNormalFunction, | 2212 : FunctionKind::kNormalFunction, |
| 2208 pos, FunctionLiteral::DECLARATION, FunctionLiteral::NORMAL_ARITY, | 2213 pos, FunctionLiteral::DECLARATION, FunctionLiteral::NORMAL_ARITY, |
| 2209 language_mode(), CHECK_OK); | 2214 language_mode(), CHECK_OK); |
| 2215 if (fni_ != NULL) fni_->Leave(); |
| 2216 |
| 2210 // Even if we're not at the top-level of the global or a function | 2217 // Even if we're not at the top-level of the global or a function |
| 2211 // scope, we treat it as such and introduce the function with its | 2218 // scope, we treat it as such and introduce the function with its |
| 2212 // initial value upon entering the corresponding scope. | 2219 // initial value upon entering the corresponding scope. |
| 2213 // In ES6, a function behaves as a lexical binding, except in | 2220 // In ES6, a function behaves as a lexical binding, except in |
| 2214 // a script scope, or the initial scope of eval or another function. | 2221 // a script scope, or the initial scope of eval or another function. |
| 2215 VariableMode mode = | 2222 VariableMode mode = |
| 2216 is_strong(language_mode()) | 2223 is_strong(language_mode()) |
| 2217 ? CONST | 2224 ? CONST |
| 2218 : (is_strict(language_mode()) || allow_harmony_sloppy()) && | 2225 : (is_strict(language_mode()) || allow_harmony_sloppy()) && |
| 2219 !(scope_->is_script_scope() || scope_->is_eval_scope() || | 2226 !(scope_->is_script_scope() || scope_->is_eval_scope() || |
| (...skipping 3762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5982 Expression* Parser::SpreadCallNew(Expression* function, | 5989 Expression* Parser::SpreadCallNew(Expression* function, |
| 5983 ZoneList<v8::internal::Expression*>* args, | 5990 ZoneList<v8::internal::Expression*>* args, |
| 5984 int pos) { | 5991 int pos) { |
| 5985 args->InsertAt(0, function, zone()); | 5992 args->InsertAt(0, function, zone()); |
| 5986 | 5993 |
| 5987 return factory()->NewCallRuntime( | 5994 return factory()->NewCallRuntime( |
| 5988 ast_value_factory()->reflect_construct_string(), NULL, args, pos); | 5995 ast_value_factory()->reflect_construct_string(), NULL, args, pos); |
| 5989 } | 5996 } |
| 5990 } // namespace internal | 5997 } // namespace internal |
| 5991 } // namespace v8 | 5998 } // namespace v8 |
| OLD | NEW |