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

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

Issue 10832401: Gentle start with removing explicit interfaces (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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
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 "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/compiler_stats.h" 10 #include "vm/compiler_stats.h"
(...skipping 4493 matching lines...) Expand 10 before | Expand all | Expand 10 after
4504 4504
4505 LocalVariable* function_variable = NULL; 4505 LocalVariable* function_variable = NULL;
4506 Type& function_type = Type::ZoneHandle(); 4506 Type& function_type = Type::ZoneHandle();
4507 if (variable_name != NULL) { 4507 if (variable_name != NULL) {
4508 // Since the function type depends on the signature of the closure function, 4508 // Since the function type depends on the signature of the closure function,
4509 // it cannot be determined before the formal parameter list of the closure 4509 // it cannot be determined before the formal parameter list of the closure
4510 // function is parsed. Therefore, we set the function type to a new 4510 // function is parsed. Therefore, we set the function type to a new
4511 // parameterized type to be patched after the actual type is known. 4511 // parameterized type to be patched after the actual type is known.
4512 // We temporarily use the class of the Function interface. 4512 // We temporarily use the class of the Function interface.
4513 const Class& unknown_signature_class = Class::Handle( 4513 const Class& unknown_signature_class = Class::Handle(
4514 Type::Handle(Type::FunctionInterface()).type_class()); 4514 Type::Handle(Type::Function()).type_class());
4515 function_type = Type::New( 4515 function_type = Type::New(
4516 unknown_signature_class, TypeArguments::Handle(), ident_pos); 4516 unknown_signature_class, TypeArguments::Handle(), ident_pos);
4517 function_type.set_is_finalized_instantiated(); // No finalization needed. 4517 function_type.set_is_finalized_instantiated(); // No finalization needed.
4518 4518
4519 // Add the function variable to the scope before parsing the function in 4519 // Add the function variable to the scope before parsing the function in
4520 // order to allow self reference from inside the function. 4520 // order to allow self reference from inside the function.
4521 function_variable = new LocalVariable(ident_pos, 4521 function_variable = new LocalVariable(ident_pos,
4522 *variable_name, 4522 *variable_name,
4523 function_type); 4523 function_type);
4524 function_variable->set_is_final(); 4524 function_variable->set_is_final();
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
4671 return false; 4671 return false;
4672 } 4672 }
4673 } 4673 }
4674 return true; 4674 return true;
4675 } 4675 }
4676 4676
4677 4677
4678 bool Parser::IsSimpleLiteral(const AbstractType& type, Instance* value) { 4678 bool Parser::IsSimpleLiteral(const AbstractType& type, Instance* value) {
4679 bool no_check = type.IsDynamicType(); 4679 bool no_check = type.IsDynamicType();
4680 if ((CurrentToken() == Token::kINTEGER) && 4680 if ((CurrentToken() == Token::kINTEGER) &&
4681 (no_check || type.IsIntInterface() || type.IsNumberInterface())) { 4681 (no_check || type.IsIntInterface() || type.IsNumberType())) {
4682 *value = CurrentIntegerLiteral(); 4682 *value = CurrentIntegerLiteral();
4683 return true; 4683 return true;
4684 } else if ((CurrentToken() == Token::kDOUBLE) && 4684 } else if ((CurrentToken() == Token::kDOUBLE) &&
4685 (no_check || type.IsDoubleInterface() || type.IsNumberInterface())) { 4685 (no_check || type.IsDoubleInterface() || type.IsNumberType())) {
4686 *value = CurrentDoubleLiteral(); 4686 *value = CurrentDoubleLiteral();
4687 return true; 4687 return true;
4688 } else if ((CurrentToken() == Token::kSTRING) && 4688 } else if ((CurrentToken() == Token::kSTRING) &&
4689 (no_check || type.IsStringInterface())) { 4689 (no_check || type.IsStringInterface())) {
4690 *value = CurrentLiteral()->raw(); 4690 *value = CurrentLiteral()->raw();
4691 return true; 4691 return true;
4692 } else if ((CurrentToken() == Token::kTRUE) && 4692 } else if ((CurrentToken() == Token::kTRUE) &&
4693 (no_check || type.IsBoolInterface())) { 4693 (no_check || type.IsBoolInterface())) {
4694 *value = Bool::True(); 4694 *value = Bool::True();
4695 return true; 4695 return true;
(...skipping 4530 matching lines...) Expand 10 before | Expand all | Expand 10 after
9226 void Parser::SkipQualIdent() { 9226 void Parser::SkipQualIdent() {
9227 ASSERT(IsIdentifier()); 9227 ASSERT(IsIdentifier());
9228 ConsumeToken(); 9228 ConsumeToken();
9229 if (CurrentToken() == Token::kPERIOD) { 9229 if (CurrentToken() == Token::kPERIOD) {
9230 ConsumeToken(); // Consume the kPERIOD token. 9230 ConsumeToken(); // Consume the kPERIOD token.
9231 ExpectIdentifier("identifier expected after '.'"); 9231 ExpectIdentifier("identifier expected after '.'");
9232 } 9232 }
9233 } 9233 }
9234 9234
9235 } // namespace dart 9235 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698