Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: src/parser.h

Issue 795573005: ES6 computed property names (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) { 411 bool IsConstructorProperty(ObjectLiteral::Property* property) {
412 return property->key()->raw_value()->EqualsString( 412 // TODO(arv): Do we still need this?
413 return property->key()->AsLiteral()->raw_value()->EqualsString(
413 ast_value_factory()->constructor_string()); 414 ast_value_factory()->constructor_string());
414 } 415 }
415 416
416 static Expression* GetPropertyValue(ObjectLiteral::Property* property) { 417 static Expression* GetPropertyValue(ObjectLiteral::Property* property) {
417 return property->value(); 418 return property->value();
418 } 419 }
419 420
420 // Functions for encapsulating the differences between parsing and preparsing; 421 // Functions for encapsulating the differences between parsing and preparsing;
421 // operations interleaved with the recursive descent. 422 // operations interleaved with the recursive descent.
422 static void PushLiteralName(FuncNameInferrer* fni, const AstRawString* id) { 423 static void PushLiteralName(FuncNameInferrer* fni, const AstRawString* id) {
423 fni->PushLiteralName(id); 424 fni->PushLiteralName(id);
424 } 425 }
426 static void PushLiteralName(FuncNameInferrer* fni, Expression* expression) {
427 fni->PushLiteralName(expression);
428 }
425 void PushPropertyName(FuncNameInferrer* fni, Expression* expression); 429 void PushPropertyName(FuncNameInferrer* fni, Expression* expression);
430 static void PushVariableName(FuncNameInferrer* fni, const AstRawString* id) {
431 fni->PushVariableName(id);
432 }
426 static void InferFunctionName(FuncNameInferrer* fni, 433 static void InferFunctionName(FuncNameInferrer* fni,
427 FunctionLiteral* func_to_infer) { 434 FunctionLiteral* func_to_infer) {
428 fni->AddFunction(func_to_infer); 435 fni->AddFunction(func_to_infer);
429 } 436 }
430 437
431 static void CheckFunctionLiteralInsideTopLevelObjectLiteral( 438 static void CheckFunctionLiteralInsideTopLevelObjectLiteral(
432 Scope* scope, ObjectLiteralProperty* property, bool* has_function) { 439 Scope* scope, ObjectLiteralProperty* property, bool* has_function) {
433 Expression* value = property->value(); 440 Expression* value = property->value();
434 if (scope->DeclarationScope()->is_script_scope() && 441 if (scope->DeclarationScope()->is_script_scope() &&
435 value->AsFunctionLiteral() != NULL) { 442 value->AsFunctionLiteral() != NULL) {
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 } 1003 }
997 1004
998 1005
999 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, 1006 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state,
1000 int start, Expression* tag) { 1007 int start, Expression* tag) {
1001 return parser_->CloseTemplateLiteral(state, start, tag); 1008 return parser_->CloseTemplateLiteral(state, start, tag);
1002 } 1009 }
1003 } } // namespace v8::internal 1010 } } // namespace v8::internal
1004 1011
1005 #endif // V8_PARSER_H_ 1012 #endif // V8_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698