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

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

Issue 11633054: Implemented class literals in the VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | 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 7458 matching lines...) Expand 10 before | Expand all | Expand 10 after
7469 selector = ParseClosureCall(closure); 7469 selector = ParseClosureCall(closure);
7470 } 7470 }
7471 } else { 7471 } else {
7472 // No (more) selectors to parse. 7472 // No (more) selectors to parse.
7473 left = LoadFieldIfUnresolved(left); 7473 left = LoadFieldIfUnresolved(left);
7474 if (left->IsPrimaryNode()) { 7474 if (left->IsPrimaryNode()) {
7475 PrimaryNode* primary = left->AsPrimaryNode(); 7475 PrimaryNode* primary = left->AsPrimaryNode();
7476 if (primary->primary().IsFunction()) { 7476 if (primary->primary().IsFunction()) {
7477 // Treat as implicit closure. 7477 // Treat as implicit closure.
7478 left = LoadClosure(primary); 7478 left = LoadClosure(primary);
7479 } else if (left->AsPrimaryNode()->primary().IsClass()) { 7479 } else if (primary->primary().IsClass()) {
7480 Class& cls = Class::CheckedHandle( 7480 const Class& type_class = Class::Cast(primary->primary());
7481 left->AsPrimaryNode()->primary().raw()); 7481 Type& type = Type::ZoneHandle(
7482 String& cls_name = String::Handle(cls.Name()); 7482 Type::New(type_class, TypeArguments::Handle(),
7483 ErrorMsg(left->token_pos(), 7483 primary->token_pos(), Heap::kOld));
7484 "illegal use of class name '%s'", 7484 type ^= ClassFinalizer::FinalizeType(
7485 cls_name.ToCString()); 7485 current_class(), type, ClassFinalizer::kCanonicalize);
7486 left = new TypeNode(primary->token_pos(), type);
7486 } else if (primary->IsSuper()) { 7487 } else if (primary->IsSuper()) {
7487 // Return "super" to handle unary super operator calls, 7488 // Return "super" to handle unary super operator calls,
7488 // or to report illegal use of "super" otherwise. 7489 // or to report illegal use of "super" otherwise.
7489 left = primary; 7490 left = primary;
7490 } else { 7491 } else {
7491 UNREACHABLE(); // Internal parser error. 7492 UNREACHABLE(); // Internal parser error.
7492 } 7493 }
7493 } 7494 }
7494 // Done parsing selectors. 7495 // Done parsing selectors.
7495 return left; 7496 return left;
(...skipping 2198 matching lines...) Expand 10 before | Expand all | Expand 10 after
9694 void Parser::SkipQualIdent() { 9695 void Parser::SkipQualIdent() {
9695 ASSERT(IsIdentifier()); 9696 ASSERT(IsIdentifier());
9696 ConsumeToken(); 9697 ConsumeToken();
9697 if (CurrentToken() == Token::kPERIOD) { 9698 if (CurrentToken() == Token::kPERIOD) {
9698 ConsumeToken(); // Consume the kPERIOD token. 9699 ConsumeToken(); // Consume the kPERIOD token.
9699 ExpectIdentifier("identifier expected after '.'"); 9700 ExpectIdentifier("identifier expected after '.'");
9700 } 9701 }
9701 } 9702 }
9702 9703
9703 } // namespace dart 9704 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698