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 "include/v8stdint.h" | 7 #include "include/v8stdint.h" |
8 | 8 |
9 #include "src/allocation.h" | 9 #include "src/allocation.h" |
10 #include "src/base/logging.h" | 10 #include "src/base/logging.h" |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 325 |
326 | 326 |
327 PreParser::Statement PreParser::ParseFunctionDeclaration(bool* ok) { | 327 PreParser::Statement PreParser::ParseFunctionDeclaration(bool* ok) { |
328 // FunctionDeclaration :: | 328 // FunctionDeclaration :: |
329 // 'function' Identifier '(' FormalParameterListopt ')' '{' FunctionBody '}' | 329 // 'function' Identifier '(' FormalParameterListopt ')' '{' FunctionBody '}' |
330 // GeneratorDeclaration :: | 330 // GeneratorDeclaration :: |
331 // 'function' '*' Identifier '(' FormalParameterListopt ')' | 331 // 'function' '*' Identifier '(' FormalParameterListopt ')' |
332 // '{' FunctionBody '}' | 332 // '{' FunctionBody '}' |
333 Expect(Token::FUNCTION, CHECK_OK); | 333 Expect(Token::FUNCTION, CHECK_OK); |
334 int pos = position(); | 334 int pos = position(); |
335 bool is_generator = allow_generators() && Check(Token::MUL); | 335 bool is_generator = Check(Token::MUL); |
336 bool is_strict_reserved = false; | 336 bool is_strict_reserved = false; |
337 Identifier name = ParseIdentifierOrStrictReservedWord( | 337 Identifier name = ParseIdentifierOrStrictReservedWord( |
338 &is_strict_reserved, CHECK_OK); | 338 &is_strict_reserved, CHECK_OK); |
339 ParseFunctionLiteral(name, scanner()->location(), is_strict_reserved, | 339 ParseFunctionLiteral(name, scanner()->location(), is_strict_reserved, |
340 is_generator ? FunctionKind::kGeneratorFunction | 340 is_generator ? FunctionKind::kGeneratorFunction |
341 : FunctionKind::kNormalFunction, | 341 : FunctionKind::kNormalFunction, |
342 pos, FunctionLiteral::DECLARATION, | 342 pos, FunctionLiteral::DECLARATION, |
343 FunctionLiteral::NORMAL_ARITY, CHECK_OK); | 343 FunctionLiteral::NORMAL_ARITY, CHECK_OK); |
344 return Statement::FunctionDeclaration(); | 344 return Statement::FunctionDeclaration(); |
345 } | 345 } |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 ParseIdentifier(kAllowEvalOrArguments, CHECK_OK); | 928 ParseIdentifier(kAllowEvalOrArguments, CHECK_OK); |
929 ParseArguments(ok); | 929 ParseArguments(ok); |
930 | 930 |
931 return Expression::Default(); | 931 return Expression::Default(); |
932 } | 932 } |
933 | 933 |
934 #undef CHECK_OK | 934 #undef CHECK_OK |
935 | 935 |
936 | 936 |
937 } } // v8::internal | 937 } } // v8::internal |
OLD | NEW |