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 #ifndef V8_PARSER_H_ | 5 #ifndef V8_PARSER_H_ |
6 #define V8_PARSER_H_ | 6 #define V8_PARSER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/ast.h" | 9 #include "src/ast.h" |
10 #include "src/compiler.h" // For CachedDataMode | 10 #include "src/compiler.h" // For CachedDataMode |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 } | 401 } |
402 | 402 |
403 static bool IsBoilerplateProperty(ObjectLiteral::Property* property) { | 403 static bool IsBoilerplateProperty(ObjectLiteral::Property* property) { |
404 return ObjectLiteral::IsBoilerplateProperty(property); | 404 return ObjectLiteral::IsBoilerplateProperty(property); |
405 } | 405 } |
406 | 406 |
407 static bool IsArrayIndex(const AstRawString* string, uint32_t* index) { | 407 static bool IsArrayIndex(const AstRawString* string, uint32_t* index) { |
408 return string->AsArrayIndex(index); | 408 return string->AsArrayIndex(index); |
409 } | 409 } |
410 | 410 |
411 bool IsConstructorProperty(ObjectLiteral::Property* property) { | |
412 return property->key()->raw_value()->EqualsString( | |
413 ast_value_factory()->constructor_string()); | |
414 } | |
415 | |
416 static Expression* GetPropertyValue(ObjectLiteral::Property* property) { | 411 static Expression* GetPropertyValue(ObjectLiteral::Property* property) { |
417 return property->value(); | 412 return property->value(); |
418 } | 413 } |
419 | 414 |
420 // Functions for encapsulating the differences between parsing and preparsing; | 415 // Functions for encapsulating the differences between parsing and preparsing; |
421 // operations interleaved with the recursive descent. | 416 // operations interleaved with the recursive descent. |
422 static void PushLiteralName(FuncNameInferrer* fni, const AstRawString* id) { | 417 static void PushLiteralName(FuncNameInferrer* fni, const AstRawString* id) { |
423 fni->PushLiteralName(id); | 418 fni->PushLiteralName(id); |
424 } | 419 } |
| 420 |
425 void PushPropertyName(FuncNameInferrer* fni, Expression* expression); | 421 void PushPropertyName(FuncNameInferrer* fni, Expression* expression); |
| 422 |
426 static void InferFunctionName(FuncNameInferrer* fni, | 423 static void InferFunctionName(FuncNameInferrer* fni, |
427 FunctionLiteral* func_to_infer) { | 424 FunctionLiteral* func_to_infer) { |
428 fni->AddFunction(func_to_infer); | 425 fni->AddFunction(func_to_infer); |
429 } | 426 } |
430 | 427 |
431 static void CheckFunctionLiteralInsideTopLevelObjectLiteral( | 428 static void CheckFunctionLiteralInsideTopLevelObjectLiteral( |
432 Scope* scope, ObjectLiteralProperty* property, bool* has_function) { | 429 Scope* scope, ObjectLiteralProperty* property, bool* has_function) { |
433 Expression* value = property->value(); | 430 Expression* value = property->value(); |
434 if (scope->DeclarationScope()->is_script_scope() && | 431 if (scope->DeclarationScope()->is_script_scope() && |
435 value->AsFunctionLiteral() != NULL) { | 432 value->AsFunctionLiteral() != NULL) { |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 } | 993 } |
997 | 994 |
998 | 995 |
999 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, | 996 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, |
1000 int start, Expression* tag) { | 997 int start, Expression* tag) { |
1001 return parser_->CloseTemplateLiteral(state, start, tag); | 998 return parser_->CloseTemplateLiteral(state, start, tag); |
1002 } | 999 } |
1003 } } // namespace v8::internal | 1000 } } // namespace v8::internal |
1004 | 1001 |
1005 #endif // V8_PARSER_H_ | 1002 #endif // V8_PARSER_H_ |
OLD | NEW |