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

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 7 years, 11 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
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | tests/co19/co19-runtime.status » ('j') | 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 "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 6872 matching lines...) Expand 10 before | Expand all | Expand 10 after
6883 *expr = right_node; 6883 *expr = right_node;
6884 return left_node; 6884 return left_node;
6885 } 6885 }
6886 return *expr; 6886 return *expr;
6887 } 6887 }
6888 6888
6889 6889
6890 // Ensure that the expression temp is allocated for nodes that may need it. 6890 // Ensure that the expression temp is allocated for nodes that may need it.
6891 AstNode* Parser::CreateAssignmentNode(AstNode* original, AstNode* rhs) { 6891 AstNode* Parser::CreateAssignmentNode(AstNode* original, AstNode* rhs) {
6892 AstNode* result = original->MakeAssignmentNode(rhs); 6892 AstNode* result = original->MakeAssignmentNode(rhs);
6893 if ((result == NULL) && original->IsTypeNode()) {
6894 const String& type_name = String::ZoneHandle(
6895 original->AsTypeNode()->type().ClassName());
6896 result = ThrowNoSuchMethodError(original->token_pos(), type_name);
6897 }
regis 2012/12/27 22:51:24 Why is this code here and not in TypeNode's MakeAs
Tom Ball 2012/12/27 23:16:31 I was following existing code here for a test of o
6893 if ((result != NULL) && 6898 if ((result != NULL) &&
6894 (result->IsStoreIndexedNode() || 6899 (result->IsStoreIndexedNode() ||
6895 result->IsInstanceSetterNode() || 6900 result->IsInstanceSetterNode() ||
6896 result->IsStaticSetterNode() || 6901 result->IsStaticSetterNode() ||
6897 result->IsStoreStaticFieldNode() || 6902 result->IsStoreStaticFieldNode() ||
6898 result->IsStoreLocalNode())) { 6903 result->IsStoreLocalNode())) {
6899 EnsureExpressionTemp(); 6904 EnsureExpressionTemp();
6900 } 6905 }
6901 return result; 6906 return result;
6902 } 6907 }
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
7475 selector = ParseClosureCall(closure); 7480 selector = ParseClosureCall(closure);
7476 } 7481 }
7477 } else { 7482 } else {
7478 // No (more) selectors to parse. 7483 // No (more) selectors to parse.
7479 left = LoadFieldIfUnresolved(left); 7484 left = LoadFieldIfUnresolved(left);
7480 if (left->IsPrimaryNode()) { 7485 if (left->IsPrimaryNode()) {
7481 PrimaryNode* primary = left->AsPrimaryNode(); 7486 PrimaryNode* primary = left->AsPrimaryNode();
7482 if (primary->primary().IsFunction()) { 7487 if (primary->primary().IsFunction()) {
7483 // Treat as implicit closure. 7488 // Treat as implicit closure.
7484 left = LoadClosure(primary); 7489 left = LoadClosure(primary);
7485 } else if (left->AsPrimaryNode()->primary().IsClass()) { 7490 } else if (primary->primary().IsClass()) {
7486 Class& cls = Class::CheckedHandle( 7491 const Class& type_class = Class::Cast(primary->primary());
7487 left->AsPrimaryNode()->primary().raw()); 7492 Type& type = Type::ZoneHandle(
7488 String& cls_name = String::Handle(cls.Name()); 7493 Type::New(type_class, TypeArguments::Handle(),
7489 ErrorMsg(left->token_pos(), 7494 primary->token_pos(), Heap::kOld));
7490 "illegal use of class name '%s'", 7495 type ^= ClassFinalizer::FinalizeType(
7491 cls_name.ToCString()); 7496 current_class(), type, ClassFinalizer::kCanonicalize);
7497 left = new TypeNode(primary->token_pos(), type);
7492 } else if (primary->IsSuper()) { 7498 } else if (primary->IsSuper()) {
7493 // Return "super" to handle unary super operator calls, 7499 // Return "super" to handle unary super operator calls,
7494 // or to report illegal use of "super" otherwise. 7500 // or to report illegal use of "super" otherwise.
7495 left = primary; 7501 left = primary;
7496 } else { 7502 } else {
7497 UNREACHABLE(); // Internal parser error. 7503 UNREACHABLE(); // Internal parser error.
7498 } 7504 }
7499 } 7505 }
7500 // Done parsing selectors. 7506 // Done parsing selectors.
7501 return left; 7507 return left;
(...skipping 2198 matching lines...) Expand 10 before | Expand all | Expand 10 after
9700 void Parser::SkipQualIdent() { 9706 void Parser::SkipQualIdent() {
9701 ASSERT(IsIdentifier()); 9707 ASSERT(IsIdentifier());
9702 ConsumeToken(); 9708 ConsumeToken();
9703 if (CurrentToken() == Token::kPERIOD) { 9709 if (CurrentToken() == Token::kPERIOD) {
9704 ConsumeToken(); // Consume the kPERIOD token. 9710 ConsumeToken(); // Consume the kPERIOD token.
9705 ExpectIdentifier("identifier expected after '.'"); 9711 ExpectIdentifier("identifier expected after '.'");
9706 } 9712 }
9707 } 9713 }
9708 9714
9709 } // namespace dart 9715 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | tests/co19/co19-runtime.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698