| 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 } | 406 } |
| 407 | 407 |
| 408 static bool IsBoilerplateProperty(ObjectLiteral::Property* property) { | 408 static bool IsBoilerplateProperty(ObjectLiteral::Property* property) { |
| 409 return ObjectLiteral::IsBoilerplateProperty(property); | 409 return ObjectLiteral::IsBoilerplateProperty(property); |
| 410 } | 410 } |
| 411 | 411 |
| 412 static bool IsArrayIndex(const AstRawString* string, uint32_t* index) { | 412 static bool IsArrayIndex(const AstRawString* string, uint32_t* index) { |
| 413 return string->AsArrayIndex(index); | 413 return string->AsArrayIndex(index); |
| 414 } | 414 } |
| 415 | 415 |
| 416 bool IsConstructorProperty(ObjectLiteral::Property* property) { | |
| 417 return property->key()->raw_value()->EqualsString( | |
| 418 ast_value_factory()->constructor_string()); | |
| 419 } | |
| 420 | |
| 421 static Expression* GetPropertyValue(ObjectLiteral::Property* property) { | 416 static Expression* GetPropertyValue(ObjectLiteral::Property* property) { |
| 422 return property->value(); | 417 return property->value(); |
| 423 } | 418 } |
| 424 | 419 |
| 425 // Functions for encapsulating the differences between parsing and preparsing; | 420 // Functions for encapsulating the differences between parsing and preparsing; |
| 426 // operations interleaved with the recursive descent. | 421 // operations interleaved with the recursive descent. |
| 427 static void PushLiteralName(FuncNameInferrer* fni, const AstRawString* id) { | 422 static void PushLiteralName(FuncNameInferrer* fni, const AstRawString* id) { |
| 428 fni->PushLiteralName(id); | 423 fni->PushLiteralName(id); |
| 429 } | 424 } |
| 425 |
| 430 void PushPropertyName(FuncNameInferrer* fni, Expression* expression); | 426 void PushPropertyName(FuncNameInferrer* fni, Expression* expression); |
| 427 |
| 431 static void InferFunctionName(FuncNameInferrer* fni, | 428 static void InferFunctionName(FuncNameInferrer* fni, |
| 432 FunctionLiteral* func_to_infer) { | 429 FunctionLiteral* func_to_infer) { |
| 433 fni->AddFunction(func_to_infer); | 430 fni->AddFunction(func_to_infer); |
| 434 } | 431 } |
| 435 | 432 |
| 436 static void CheckFunctionLiteralInsideTopLevelObjectLiteral( | 433 static void CheckFunctionLiteralInsideTopLevelObjectLiteral( |
| 437 Scope* scope, ObjectLiteralProperty* property, bool* has_function) { | 434 Scope* scope, ObjectLiteralProperty* property, bool* has_function) { |
| 438 Expression* value = property->value(); | 435 Expression* value = property->value(); |
| 439 if (scope->DeclarationScope()->is_script_scope() && | 436 if (scope->DeclarationScope()->is_script_scope() && |
| 440 value->AsFunctionLiteral() != NULL) { | 437 value->AsFunctionLiteral() != NULL) { |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 } | 1000 } |
| 1004 | 1001 |
| 1005 | 1002 |
| 1006 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, | 1003 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, |
| 1007 int start, Expression* tag) { | 1004 int start, Expression* tag) { |
| 1008 return parser_->CloseTemplateLiteral(state, start, tag); | 1005 return parser_->CloseTemplateLiteral(state, start, tag); |
| 1009 } | 1006 } |
| 1010 } } // namespace v8::internal | 1007 } } // namespace v8::internal |
| 1011 | 1008 |
| 1012 #endif // V8_PARSER_H_ | 1009 #endif // V8_PARSER_H_ |
| OLD | NEW |