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

Side by Side Diff: runtime/vm/parser.cc

Issue 22916006: Move the begin token of explicit functions to the start of the function declaration. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 months 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 | Annotate | Revision Log
« runtime/vm/object_test.cc ('K') | « runtime/vm/parser.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/parser.h" 5 #include "vm/parser.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/bigint_operations.h" 8 #include "vm/bigint_operations.h"
9 #include "vm/bootstrap.h" 9 #include "vm/bootstrap.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 bool has_final; 519 bool has_final;
520 bool has_const; 520 bool has_const;
521 bool has_static; 521 bool has_static;
522 bool has_var; 522 bool has_var;
523 bool has_factory; 523 bool has_factory;
524 bool has_operator; 524 bool has_operator;
525 intptr_t metadata_pos; 525 intptr_t metadata_pos;
526 Token::Kind operator_token; 526 Token::Kind operator_token;
527 const AbstractType* type; 527 const AbstractType* type;
528 intptr_t name_pos; 528 intptr_t name_pos;
529 intptr_t decl_begin_pos;
529 String* name; 530 String* name;
530 // For constructors: NULL or name of redirected to constructor. 531 // For constructors: NULL or name of redirected to constructor.
531 String* redirect_name; 532 String* redirect_name;
532 // For constructors: NULL for unnamed constructor, 533 // For constructors: NULL for unnamed constructor,
533 // identifier after classname for named constructors. 534 // identifier after classname for named constructors.
534 String* constructor_name; 535 String* constructor_name;
535 ParamList params; 536 ParamList params;
536 RawFunction::Kind kind; 537 RawFunction::Kind kind;
537 }; 538 };
538 539
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 SequenceNode* node_sequence = NULL; 758 SequenceNode* node_sequence = NULL;
758 Array& default_parameter_values = Array::ZoneHandle(isolate, Array::null()); 759 Array& default_parameter_values = Array::ZoneHandle(isolate, Array::null());
759 switch (func.kind()) { 760 switch (func.kind()) {
760 case RawFunction::kRegularFunction: 761 case RawFunction::kRegularFunction:
761 case RawFunction::kClosureFunction: 762 case RawFunction::kClosureFunction:
762 case RawFunction::kGetterFunction: 763 case RawFunction::kGetterFunction:
763 case RawFunction::kSetterFunction: 764 case RawFunction::kSetterFunction:
764 case RawFunction::kConstructor: 765 case RawFunction::kConstructor:
765 // The call to a redirecting factory is redirected. 766 // The call to a redirecting factory is redirected.
766 ASSERT(!func.IsRedirectingFactory()); 767 ASSERT(!func.IsRedirectingFactory());
768 parser.SkipFunctionPreamble(func);
767 node_sequence = parser.ParseFunc(func, default_parameter_values); 769 node_sequence = parser.ParseFunc(func, default_parameter_values);
768 break; 770 break;
769 case RawFunction::kImplicitGetter: 771 case RawFunction::kImplicitGetter:
770 ASSERT(!func.is_static()); 772 ASSERT(!func.is_static());
771 node_sequence = parser.ParseInstanceGetter(func); 773 node_sequence = parser.ParseInstanceGetter(func);
772 break; 774 break;
773 case RawFunction::kImplicitSetter: 775 case RawFunction::kImplicitSetter:
774 ASSERT(!func.is_static()); 776 ASSERT(!func.is_static());
775 node_sequence = parser.ParseInstanceSetter(func); 777 node_sequence = parser.ParseInstanceSetter(func);
776 break; 778 break;
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 1412
1411 // The field 'is_static' has no meaning for signature functions. 1413 // The field 'is_static' has no meaning for signature functions.
1412 const Function& signature_function = Function::Handle( 1414 const Function& signature_function = Function::Handle(
1413 Function::New(*parameter.name, 1415 Function::New(*parameter.name,
1414 RawFunction::kSignatureFunction, 1416 RawFunction::kSignatureFunction,
1415 /* is_static = */ false, 1417 /* is_static = */ false,
1416 /* is_const = */ false, 1418 /* is_const = */ false,
1417 /* is_abstract = */ false, 1419 /* is_abstract = */ false,
1418 /* is_external = */ false, 1420 /* is_external = */ false,
1419 current_class(), 1421 current_class(),
1420 parameter.name_pos)); 1422 parameter.name_pos));
hausner 2013/08/13 15:40:11 In the case of typedef, you change the token posit
Michael Lippautz (Google) 2013/08/13 18:07:34 This is about closure parameters, so the beginning
1421 signature_function.set_result_type(result_type); 1423 signature_function.set_result_type(result_type);
1422 AddFormalParamsToFunction(&func_params, signature_function); 1424 AddFormalParamsToFunction(&func_params, signature_function);
1423 const String& signature = String::Handle(signature_function.Signature()); 1425 const String& signature = String::Handle(signature_function.Signature());
1424 // Lookup the signature class, i.e. the class whose name is the signature. 1426 // Lookup the signature class, i.e. the class whose name is the signature.
1425 // We only lookup in the current library, but not in its imports, and only 1427 // We only lookup in the current library, but not in its imports, and only
1426 // create a new canonical signature class if it does not exist yet. 1428 // create a new canonical signature class if it does not exist yet.
1427 Class& signature_class = Class::ZoneHandle( 1429 Class& signature_class = Class::ZoneHandle(
1428 library_.LookupLocalClass(signature)); 1430 library_.LookupLocalClass(signature));
1429 if (signature_class.IsNull()) { 1431 if (signature_class.IsNull()) {
1430 signature_class = Class::NewSignatureClass(signature, 1432 signature_class = Class::NewSignatureClass(signature,
(...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after
2828 } 2830 }
2829 } 2831 }
2830 } 2832 }
2831 } 2833 }
2832 } 2834 }
2833 2835
2834 2836
2835 void Parser::ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method) { 2837 void Parser::ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method) {
2836 TRACE_PARSER("ParseMethodOrConstructor"); 2838 TRACE_PARSER("ParseMethodOrConstructor");
2837 ASSERT(CurrentToken() == Token::kLPAREN || method->IsGetter()); 2839 ASSERT(CurrentToken() == Token::kLPAREN || method->IsGetter());
2838 intptr_t method_pos = this->TokenPos();
2839 ASSERT(method->type != NULL); 2840 ASSERT(method->type != NULL);
2840 ASSERT(method->name_pos > 0); 2841 ASSERT(method->name_pos > 0);
2841 ASSERT(current_member_ == method); 2842 ASSERT(current_member_ == method);
2842 2843
2843 if (method->has_var) { 2844 if (method->has_var) {
2844 ErrorMsg(method->name_pos, "keyword var not allowed for methods"); 2845 ErrorMsg(method->name_pos, "keyword var not allowed for methods");
2845 } 2846 }
2846 if (method->has_final) { 2847 if (method->has_final) {
2847 ErrorMsg(method->name_pos, "'final' not allowed for methods"); 2848 ErrorMsg(method->name_pos, "'final' not allowed for methods");
2848 } 2849 }
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
3082 function_kind = RawFunction::kRegularFunction; 3083 function_kind = RawFunction::kRegularFunction;
3083 } 3084 }
3084 Function& func = Function::Handle( 3085 Function& func = Function::Handle(
3085 Function::New(*method->name, 3086 Function::New(*method->name,
3086 function_kind, 3087 function_kind,
3087 method->has_static, 3088 method->has_static,
3088 method->has_const, 3089 method->has_const,
3089 method->has_abstract, 3090 method->has_abstract,
3090 method->has_external, 3091 method->has_external,
3091 current_class(), 3092 current_class(),
3092 method_pos)); 3093 method->decl_begin_pos));
3093 func.set_result_type(*method->type); 3094 func.set_result_type(*method->type);
3094 func.set_end_token_pos(method_end_pos); 3095 func.set_end_token_pos(method_end_pos);
3095 if (method->metadata_pos > 0) { 3096 if (method->metadata_pos > 0) {
3096 library_.AddFunctionMetadata(func, method->metadata_pos); 3097 library_.AddFunctionMetadata(func, method->metadata_pos);
3097 } 3098 }
3098 3099
3099 // If this method is a redirecting factory, set the redirection information. 3100 // If this method is a redirecting factory, set the redirection information.
3100 if (!redirection_type.IsNull()) { 3101 if (!redirection_type.IsNull()) {
3101 ASSERT(func.IsFactory()); 3102 ASSERT(func.IsFactory());
3102 func.SetRedirectionType(redirection_type); 3103 func.SetRedirectionType(redirection_type);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
3278 } 3279 }
3279 } 3280 }
3280 3281
3281 3282
3282 void Parser::ParseClassMemberDefinition(ClassDesc* members, 3283 void Parser::ParseClassMemberDefinition(ClassDesc* members,
3283 intptr_t metadata_pos) { 3284 intptr_t metadata_pos) {
3284 TRACE_PARSER("ParseClassMemberDefinition"); 3285 TRACE_PARSER("ParseClassMemberDefinition");
3285 MemberDesc member; 3286 MemberDesc member;
3286 current_member_ = &member; 3287 current_member_ = &member;
3287 member.metadata_pos = metadata_pos; 3288 member.metadata_pos = metadata_pos;
3289 member.decl_begin_pos = TokenPos();
3288 if ((CurrentToken() == Token::kEXTERNAL) && 3290 if ((CurrentToken() == Token::kEXTERNAL) &&
3289 (LookaheadToken(1) != Token::kLPAREN)) { 3291 (LookaheadToken(1) != Token::kLPAREN)) {
3290 ConsumeToken(); 3292 ConsumeToken();
3291 member.has_external = true; 3293 member.has_external = true;
3292 } 3294 }
3293 if ((CurrentToken() == Token::kSTATIC) && 3295 if ((CurrentToken() == Token::kSTATIC) &&
3294 (LookaheadToken(1) != Token::kLPAREN)) { 3296 (LookaheadToken(1) != Token::kLPAREN)) {
3295 ConsumeToken(); 3297 ConsumeToken();
3296 member.has_static = true; 3298 member.has_static = true;
3297 } 3299 }
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
3867 } 3869 }
3868 } 3870 }
3869 SetPosition(saved_pos); 3871 SetPosition(saved_pos);
3870 return is_mixin_def; 3872 return is_mixin_def;
3871 } 3873 }
3872 3874
3873 3875
3874 void Parser::ParseTypedef(const GrowableObjectArray& pending_classes) { 3876 void Parser::ParseTypedef(const GrowableObjectArray& pending_classes) {
3875 TRACE_PARSER("ParseTypedef"); 3877 TRACE_PARSER("ParseTypedef");
3876 ExpectToken(Token::kTYPEDEF); 3878 ExpectToken(Token::kTYPEDEF);
3879 const intptr_t decl_begin_pos = TokenPos();
3877 3880
3878 if (IsMixinTypedef()) { 3881 if (IsMixinTypedef()) {
3879 ParseMixinTypedef(pending_classes); 3882 ParseMixinTypedef(pending_classes);
3880 return; 3883 return;
3881 } 3884 }
3882 3885
3883 // Parse the result type of the function type. 3886 // Parse the result type of the function type.
3884 AbstractType& result_type = Type::Handle(Type::DynamicType()); 3887 AbstractType& result_type = Type::Handle(Type::DynamicType());
3885 if (CurrentToken() == Token::kVOID) { 3888 if (CurrentToken() == Token::kVOID) {
3886 ConsumeToken(); 3889 ConsumeToken();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
3940 ExpectSemicolon(); 3943 ExpectSemicolon();
3941 // The field 'is_static' has no meaning for signature functions. 3944 // The field 'is_static' has no meaning for signature functions.
3942 Function& signature_function = Function::Handle( 3945 Function& signature_function = Function::Handle(
3943 Function::New(*alias_name, 3946 Function::New(*alias_name,
3944 RawFunction::kSignatureFunction, 3947 RawFunction::kSignatureFunction,
3945 /* is_static = */ false, 3948 /* is_static = */ false,
3946 /* is_const = */ false, 3949 /* is_const = */ false,
3947 /* is_abstract = */ false, 3950 /* is_abstract = */ false,
3948 /* is_external = */ false, 3951 /* is_external = */ false,
3949 function_type_alias, 3952 function_type_alias,
3950 alias_name_pos)); 3953 decl_begin_pos));
3951 signature_function.set_result_type(result_type); 3954 signature_function.set_result_type(result_type);
3952 AddFormalParamsToFunction(&func_params, signature_function); 3955 AddFormalParamsToFunction(&func_params, signature_function);
3953 3956
3954 // Patch the signature function in the signature class. 3957 // Patch the signature function in the signature class.
3955 function_type_alias.PatchSignatureFunction(signature_function); 3958 function_type_alias.PatchSignatureFunction(signature_function);
3956 3959
3957 const String& signature = String::Handle(signature_function.Signature()); 3960 const String& signature = String::Handle(signature_function.Signature());
3958 if (FLAG_trace_parser) { 3961 if (FLAG_trace_parser) {
3959 OS::Print("TopLevel parsing function type alias '%s'\n", 3962 OS::Print("TopLevel parsing function type alias '%s'\n",
3960 signature.ToCString()); 3963 signature.ToCString());
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
4330 } else { 4333 } else {
4331 ExpectSemicolon(); // Reports error. 4334 ExpectSemicolon(); // Reports error.
4332 } 4335 }
4333 } 4336 }
4334 } 4337 }
4335 4338
4336 4339
4337 void Parser::ParseTopLevelFunction(TopLevel* top_level, 4340 void Parser::ParseTopLevelFunction(TopLevel* top_level,
4338 intptr_t metadata_pos) { 4341 intptr_t metadata_pos) {
4339 TRACE_PARSER("ParseTopLevelFunction"); 4342 TRACE_PARSER("ParseTopLevelFunction");
4343 const intptr_t decl_begin_pos = TokenPos();
4340 AbstractType& result_type = Type::Handle(Type::DynamicType()); 4344 AbstractType& result_type = Type::Handle(Type::DynamicType());
4341 const bool is_static = true; 4345 const bool is_static = true;
4342 bool is_external = false; 4346 bool is_external = false;
4343 bool is_patch = false; 4347 bool is_patch = false;
4344 if (is_patch_source() && 4348 if (is_patch_source() &&
4345 (CurrentToken() == Token::kIDENT) && 4349 (CurrentToken() == Token::kIDENT) &&
4346 CurrentLiteral()->Equals("patch") && 4350 CurrentLiteral()->Equals("patch") &&
4347 (LookaheadToken(1) != Token::kLPAREN)) { 4351 (LookaheadToken(1) != Token::kLPAREN)) {
4348 ConsumeToken(); 4352 ConsumeToken();
4349 is_patch = true; 4353 is_patch = true;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
4403 ErrorMsg("function block expected"); 4407 ErrorMsg("function block expected");
4404 } 4408 }
4405 Function& func = Function::Handle( 4409 Function& func = Function::Handle(
4406 Function::New(func_name, 4410 Function::New(func_name,
4407 RawFunction::kRegularFunction, 4411 RawFunction::kRegularFunction,
4408 is_static, 4412 is_static,
4409 /* is_const = */ false, 4413 /* is_const = */ false,
4410 /* is_abstract = */ false, 4414 /* is_abstract = */ false,
4411 is_external, 4415 is_external,
4412 current_class(), 4416 current_class(),
4413 function_pos)); 4417 decl_begin_pos));
4414 func.set_result_type(result_type); 4418 func.set_result_type(result_type);
4415 func.set_end_token_pos(function_end_pos); 4419 func.set_end_token_pos(function_end_pos);
4416 AddFormalParamsToFunction(&params, func); 4420 AddFormalParamsToFunction(&params, func);
4417 top_level->functions.Add(func); 4421 top_level->functions.Add(func);
4418 if (!is_patch) { 4422 if (!is_patch) {
4419 library_.AddObject(func, func_name); 4423 library_.AddObject(func, func_name);
4420 } else { 4424 } else {
4421 library_.ReplaceObject(func, func_name); 4425 library_.ReplaceObject(func, func_name);
4422 } 4426 }
4423 if (metadata_pos >= 0) { 4427 if (metadata_pos >= 0) {
4424 library_.AddFunctionMetadata(func, metadata_pos); 4428 library_.AddFunctionMetadata(func, metadata_pos);
4425 } 4429 }
4426 } 4430 }
4427 4431
4428 4432
4429 void Parser::ParseTopLevelAccessor(TopLevel* top_level, 4433 void Parser::ParseTopLevelAccessor(TopLevel* top_level,
4430 intptr_t metadata_pos) { 4434 intptr_t metadata_pos) {
4431 TRACE_PARSER("ParseTopLevelAccessor"); 4435 TRACE_PARSER("ParseTopLevelAccessor");
4436 const intptr_t decl_begin_pos = TokenPos();
4432 const bool is_static = true; 4437 const bool is_static = true;
4433 bool is_external = false; 4438 bool is_external = false;
4434 bool is_patch = false; 4439 bool is_patch = false;
4435 AbstractType& result_type = AbstractType::Handle(); 4440 AbstractType& result_type = AbstractType::Handle();
4436 if (is_patch_source() && 4441 if (is_patch_source() &&
4437 (CurrentToken() == Token::kIDENT) && 4442 (CurrentToken() == Token::kIDENT) &&
4438 CurrentLiteral()->Equals("patch")) { 4443 CurrentLiteral()->Equals("patch")) {
4439 ConsumeToken(); 4444 ConsumeToken();
4440 is_patch = true; 4445 is_patch = true;
4441 } else if (CurrentToken() == Token::kEXTERNAL) { 4446 } else if (CurrentToken() == Token::kEXTERNAL) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
4528 } 4533 }
4529 Function& func = Function::Handle( 4534 Function& func = Function::Handle(
4530 Function::New(accessor_name, 4535 Function::New(accessor_name,
4531 is_getter? RawFunction::kGetterFunction : 4536 is_getter? RawFunction::kGetterFunction :
4532 RawFunction::kSetterFunction, 4537 RawFunction::kSetterFunction,
4533 is_static, 4538 is_static,
4534 /* is_const = */ false, 4539 /* is_const = */ false,
4535 /* is_abstract = */ false, 4540 /* is_abstract = */ false,
4536 is_external, 4541 is_external,
4537 current_class(), 4542 current_class(),
4538 accessor_pos)); 4543 decl_begin_pos));
4539 func.set_result_type(result_type); 4544 func.set_result_type(result_type);
4540 func.set_end_token_pos(accessor_end_pos); 4545 func.set_end_token_pos(accessor_end_pos);
4541 AddFormalParamsToFunction(&params, func); 4546 AddFormalParamsToFunction(&params, func);
4542 top_level->functions.Add(func); 4547 top_level->functions.Add(func);
4543 if (!is_patch) { 4548 if (!is_patch) {
4544 library_.AddObject(func, accessor_name); 4549 library_.AddObject(func, accessor_name);
4545 } else { 4550 } else {
4546 library_.ReplaceObject(func, accessor_name); 4551 library_.ReplaceObject(func, accessor_name);
4547 } 4552 }
4548 if (metadata_pos >= 0) { 4553 if (metadata_pos >= 0) {
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
5268 bool is_new_closure = false; 5273 bool is_new_closure = false;
5269 // TODO(hausner): There could be two different closures at the given 5274 // TODO(hausner): There could be two different closures at the given
5270 // function_pos, one enclosed in a closurized function and one enclosed in the 5275 // function_pos, one enclosed in a closurized function and one enclosed in the
5271 // non-closurized version of this same function. 5276 // non-closurized version of this same function.
5272 function = current_class().LookupClosureFunction(function_pos); 5277 function = current_class().LookupClosureFunction(function_pos);
5273 if (function.IsNull() || (function.token_pos() != function_pos) || 5278 if (function.IsNull() || (function.token_pos() != function_pos) ||
5274 (function.parent_function() != innermost_function().raw())) { 5279 (function.parent_function() != innermost_function().raw())) {
5275 is_new_closure = true; 5280 is_new_closure = true;
5276 function = Function::NewClosureFunction(*function_name, 5281 function = Function::NewClosureFunction(*function_name,
5277 innermost_function(), 5282 innermost_function(),
5278 function_pos); 5283 function_pos);
hausner 2013/08/13 15:40:11 This case is not covered with your change. functio
Michael Lippautz (Google) 2013/08/13 18:07:34 Did miss this one. Done.
5279 function.set_result_type(result_type); 5284 function.set_result_type(result_type);
5280 current_class().AddClosureFunction(function); 5285 current_class().AddClosureFunction(function);
5281 } 5286 }
5282 5287
5283 // The function type needs to be finalized at compile time, since the closure 5288 // The function type needs to be finalized at compile time, since the closure
5284 // may be type checked at run time when assigned to a function variable, 5289 // may be type checked at run time when assigned to a function variable,
5285 // passed as a function argument, or returned as a function result. 5290 // passed as a function argument, or returned as a function result.
5286 5291
5287 LocalVariable* function_variable = NULL; 5292 LocalVariable* function_variable = NULL;
5288 Type& function_type = Type::ZoneHandle(); 5293 Type& function_type = Type::ZoneHandle();
(...skipping 4745 matching lines...) Expand 10 before | Expand all | Expand 10 after
10034 } 10039 }
10035 if (CurrentToken() == Token::kLBRACE) { 10040 if (CurrentToken() == Token::kLBRACE) {
10036 SkipBlock(); 10041 SkipBlock();
10037 } else if (CurrentToken() == Token::kARROW) { 10042 } else if (CurrentToken() == Token::kARROW) {
10038 ConsumeToken(); 10043 ConsumeToken();
10039 SkipExpr(); 10044 SkipExpr();
10040 } 10045 }
10041 } 10046 }
10042 10047
10043 10048
10049 // Skips function/method/constructor/getter/setter preambles until the formal
10050 // parameter list. It is enough to skip the tokens, since we have already
10051 // previously parsed the function.
10052 void Parser::SkipFunctionPreamble(const Function& func) {
10053 if (func.IsImplicitConstructor()) return;
10054 while (true) {
10055 if (CurrentToken() == Token::kLPAREN ||
10056 CurrentToken() == Token::kARROW ||
10057 CurrentToken() == Token::kSEMICOLON ||
10058 CurrentToken() == Token::kLBRACE) {
10059 return;
10060 }
10061 // Case handles "native" keyword, but also return types of form
10062 // native.SomeType where native is the name of a library.
10063 if (CurrentToken() == Token::kIDENT &&
10064 LookaheadToken(1) != Token::kPERIOD) {
10065 String* lit = CurrentLiteral();
10066 if (lit->Equals("native")) {
hausner 2013/08/13 15:40:11 I think you can speed this loop up by declaring a
Michael Lippautz (Google) 2013/08/13 18:07:34 Done.
10067 return;
10068 }
10069 }
10070 ConsumeToken();
10071 }
10072 }
10073
10074
10044 void Parser::SkipListLiteral() { 10075 void Parser::SkipListLiteral() {
10045 if (CurrentToken() == Token::kINDEX) { 10076 if (CurrentToken() == Token::kINDEX) {
10046 // Empty list literal. 10077 // Empty list literal.
10047 ConsumeToken(); 10078 ConsumeToken();
10048 return; 10079 return;
10049 } 10080 }
10050 ExpectToken(Token::kLBRACK); 10081 ExpectToken(Token::kLBRACK);
10051 while (CurrentToken() != Token::kRBRACK) { 10082 while (CurrentToken() != Token::kRBRACK) {
10052 SkipNestedExpr(); 10083 SkipNestedExpr();
10053 if (CurrentToken() == Token::kCOMMA) { 10084 if (CurrentToken() == Token::kCOMMA) {
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
10294 void Parser::SkipQualIdent() { 10325 void Parser::SkipQualIdent() {
10295 ASSERT(IsIdentifier()); 10326 ASSERT(IsIdentifier());
10296 ConsumeToken(); 10327 ConsumeToken();
10297 if (CurrentToken() == Token::kPERIOD) { 10328 if (CurrentToken() == Token::kPERIOD) {
10298 ConsumeToken(); // Consume the kPERIOD token. 10329 ConsumeToken(); // Consume the kPERIOD token.
10299 ExpectIdentifier("identifier expected after '.'"); 10330 ExpectIdentifier("identifier expected after '.'");
10300 } 10331 }
10301 } 10332 }
10302 10333
10303 } // namespace dart 10334 } // namespace dart
OLDNEW
« runtime/vm/object_test.cc ('K') | « runtime/vm/parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698