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

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 4455 matching lines...) Expand 10 before | Expand all | Expand 10 after
4466 4466
4467 LocalVariable* function_variable = NULL; 4467 LocalVariable* function_variable = NULL;
4468 Type& function_type = Type::ZoneHandle(); 4468 Type& function_type = Type::ZoneHandle();
4469 if (variable_name != NULL) { 4469 if (variable_name != NULL) {
4470 // Since the function type depends on the signature of the closure function, 4470 // Since the function type depends on the signature of the closure function,
4471 // it cannot be determined before the formal parameter list of the closure 4471 // it cannot be determined before the formal parameter list of the closure
4472 // function is parsed. Therefore, we set the function type to a new 4472 // function is parsed. Therefore, we set the function type to a new
4473 // parameterized type to be patched after the actual type is known. 4473 // parameterized type to be patched after the actual type is known.
4474 // We temporarily use the class of the Function interface. 4474 // We temporarily use the class of the Function interface.
4475 const Class& unknown_signature_class = Class::Handle( 4475 const Class& unknown_signature_class = Class::Handle(
4476 Type::Handle(Type::FunctionInterface()).type_class()); 4476 Type::Handle(Type::Function()).type_class());
4477 function_type = Type::New( 4477 function_type = Type::New(
4478 unknown_signature_class, TypeArguments::Handle(), ident_pos); 4478 unknown_signature_class, TypeArguments::Handle(), ident_pos);
4479 function_type.set_is_finalized_instantiated(); // No finalization needed. 4479 function_type.set_is_finalized_instantiated(); // No finalization needed.
4480 4480
4481 // Add the function variable to the scope before parsing the function in 4481 // Add the function variable to the scope before parsing the function in
4482 // order to allow self reference from inside the function. 4482 // order to allow self reference from inside the function.
4483 function_variable = new LocalVariable(ident_pos, 4483 function_variable = new LocalVariable(ident_pos,
4484 *variable_name, 4484 *variable_name,
4485 function_type); 4485 function_type);
4486 function_variable->set_is_final(); 4486 function_variable->set_is_final();
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
4633 return false; 4633 return false;
4634 } 4634 }
4635 } 4635 }
4636 return true; 4636 return true;
4637 } 4637 }
4638 4638
4639 4639
4640 bool Parser::IsSimpleLiteral(const AbstractType& type, Instance* value) { 4640 bool Parser::IsSimpleLiteral(const AbstractType& type, Instance* value) {
4641 bool no_check = type.IsDynamicType(); 4641 bool no_check = type.IsDynamicType();
4642 if ((CurrentToken() == Token::kINTEGER) && 4642 if ((CurrentToken() == Token::kINTEGER) &&
4643 (no_check || type.IsIntInterface() || type.IsNumberInterface())) { 4643 (no_check || type.IsIntInterface() || type.IsNumberType())) {
4644 *value = CurrentIntegerLiteral(); 4644 *value = CurrentIntegerLiteral();
4645 return true; 4645 return true;
4646 } else if ((CurrentToken() == Token::kDOUBLE) && 4646 } else if ((CurrentToken() == Token::kDOUBLE) &&
4647 (no_check || type.IsDoubleInterface() || type.IsNumberInterface())) { 4647 (no_check || type.IsDoubleInterface() || type.IsNumberType())) {
4648 *value = CurrentDoubleLiteral(); 4648 *value = CurrentDoubleLiteral();
4649 return true; 4649 return true;
4650 } else if ((CurrentToken() == Token::kSTRING) && 4650 } else if ((CurrentToken() == Token::kSTRING) &&
4651 (no_check || type.IsStringInterface())) { 4651 (no_check || type.IsStringInterface())) {
4652 *value = CurrentLiteral()->raw(); 4652 *value = CurrentLiteral()->raw();
4653 return true; 4653 return true;
4654 } else if ((CurrentToken() == Token::kTRUE) && 4654 } else if ((CurrentToken() == Token::kTRUE) &&
4655 (no_check || type.IsBoolInterface())) { 4655 (no_check || type.IsBoolInterface())) {
4656 *value = Bool::True(); 4656 *value = Bool::True();
4657 return true; 4657 return true;
(...skipping 4530 matching lines...) Expand 10 before | Expand all | Expand 10 after
9188 void Parser::SkipQualIdent() { 9188 void Parser::SkipQualIdent() {
9189 ASSERT(IsIdentifier()); 9189 ASSERT(IsIdentifier());
9190 ConsumeToken(); 9190 ConsumeToken();
9191 if (CurrentToken() == Token::kPERIOD) { 9191 if (CurrentToken() == Token::kPERIOD) {
9192 ConsumeToken(); // Consume the kPERIOD token. 9192 ConsumeToken(); // Consume the kPERIOD token.
9193 ExpectIdentifier("identifier expected after '.'"); 9193 ExpectIdentifier("identifier expected after '.'");
9194 } 9194 }
9195 } 9195 }
9196 9196
9197 } // namespace dart 9197 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698