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

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

Issue 1269413005: Adapt C?.m to latest spec version (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | tests/language/language.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 "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/ast_transformer.h" 9 #include "vm/ast_transformer.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 11166 matching lines...) Expand 10 before | Expand all | Expand 10 after
11177 // Make sure that the instantiator is captured. 11177 // Make sure that the instantiator is captured.
11178 CaptureInstantiator(); 11178 CaptureInstantiator();
11179 } 11179 }
11180 TypeParameter& type_parameter = TypeParameter::ZoneHandle(Z); 11180 TypeParameter& type_parameter = TypeParameter::ZoneHandle(Z);
11181 type_parameter ^= ClassFinalizer::FinalizeType( 11181 type_parameter ^= ClassFinalizer::FinalizeType(
11182 current_class(), 11182 current_class(),
11183 TypeParameter::Cast(primary_node->primary()), 11183 TypeParameter::Cast(primary_node->primary()),
11184 ClassFinalizer::kCanonicalize); 11184 ClassFinalizer::kCanonicalize);
11185 ASSERT(!type_parameter.IsMalformed()); 11185 ASSERT(!type_parameter.IsMalformed());
11186 left = new(Z) TypeNode(primary->token_pos(), type_parameter); 11186 left = new(Z) TypeNode(primary->token_pos(), type_parameter);
11187 } else if (is_conditional && primary_node->primary().IsClass()) {
11188 // The left-hand side of ?. is interpreted as an expression
11189 // of type Type, not as a class literal.
11190 const Class& type_class = Class::Cast(primary_node->primary());
11191 AbstractType& type = Type::ZoneHandle(Z,
11192 Type::New(type_class, TypeArguments::Handle(Z),
11193 primary_pos, Heap::kOld));
11194 type ^= ClassFinalizer::FinalizeType(
11195 current_class(), type, ClassFinalizer::kCanonicalize);
11196 // Type may be malbounded, but not malformed.
11197 ASSERT(!type.IsMalformed());
11198 left = new(Z) TypeNode(primary_pos, type);
11199 } else { 11187 } else {
11200 // Super field access handled in ParseSuperFieldAccess(), 11188 // Super field access handled in ParseSuperFieldAccess(),
11201 // super calls handled in ParseSuperCall(). 11189 // super calls handled in ParseSuperCall().
11202 ASSERT(!primary_node->IsSuper()); 11190 ASSERT(!primary_node->IsSuper());
11203 left = LoadFieldIfUnresolved(left); 11191 left = LoadFieldIfUnresolved(left);
11204 } 11192 }
11205 } 11193 }
11206 const intptr_t ident_pos = TokenPos(); 11194 const intptr_t ident_pos = TokenPos();
11207 String* ident = ExpectIdentifier("identifier expected"); 11195 String* ident = ExpectIdentifier("identifier expected");
11208 if (CurrentToken() == Token::kLPAREN) { 11196 if (CurrentToken() == Token::kLPAREN) {
11209 // Identifier followed by a opening paren: method call. 11197 // Identifier followed by a opening paren: method call.
11210 if (left->IsPrimaryNode() && 11198 if (left->IsPrimaryNode() &&
11211 left->AsPrimaryNode()->primary().IsClass()) { 11199 left->AsPrimaryNode()->primary().IsClass()) {
11212 // Static method call prefixed with class name. 11200 // Static method call prefixed with class name.
11213 ASSERT(!is_conditional);
11214 const Class& cls = Class::Cast(left->AsPrimaryNode()->primary()); 11201 const Class& cls = Class::Cast(left->AsPrimaryNode()->primary());
11215 selector = ParseStaticCall(cls, *ident, ident_pos); 11202 selector = ParseStaticCall(cls, *ident, ident_pos);
11216 } else { 11203 } else {
11217 selector = ParseInstanceCall(left, *ident, ident_pos, is_conditional); 11204 selector = ParseInstanceCall(left, *ident, ident_pos, is_conditional);
11218 } 11205 }
11219 } else { 11206 } else {
11220 // Field access. 11207 // Field access.
11221 Class& cls = Class::Handle(Z); 11208 Class& cls = Class::Handle(Z);
11222 bool is_deferred = false; 11209 bool is_deferred = false;
11223 if (left->IsPrimaryNode()) { 11210 if (left->IsPrimaryNode()) {
11224 PrimaryNode* primary_node = left->AsPrimaryNode(); 11211 PrimaryNode* primary_node = left->AsPrimaryNode();
11225 if (primary_node->primary().IsClass()) { 11212 if (primary_node->primary().IsClass()) {
11226 // If the primary node referred to a class we are loading a 11213 // If the primary node referred to a class we are loading a
11227 // qualified static field. 11214 // qualified static field.
11228 cls ^= primary_node->primary().raw(); 11215 cls ^= primary_node->primary().raw();
11229 is_deferred = primary_node->is_deferred_reference(); 11216 is_deferred = primary_node->is_deferred_reference();
11230 } 11217 }
11231 } 11218 }
11232 if (cls.IsNull()) { 11219 if (cls.IsNull()) {
11233 // Instance field access. 11220 // Instance field access.
11234 selector = new(Z) InstanceGetterNode(ident_pos, 11221 selector = new(Z) InstanceGetterNode(ident_pos,
11235 left, 11222 left,
11236 *ident, 11223 *ident,
11237 is_conditional); 11224 is_conditional);
11238 } else { 11225 } else {
11239 // Static field access. 11226 // Static field access.
11240 ASSERT(!is_conditional);
11241 selector = GenerateStaticFieldAccess(cls, *ident, ident_pos); 11227 selector = GenerateStaticFieldAccess(cls, *ident, ident_pos);
11242 ASSERT(selector != NULL); 11228 ASSERT(selector != NULL);
11243 if (selector->IsLoadStaticFieldNode()) { 11229 if (selector->IsLoadStaticFieldNode()) {
11244 selector->AsLoadStaticFieldNode()->set_is_deferred(is_deferred); 11230 selector->AsLoadStaticFieldNode()->set_is_deferred(is_deferred);
11245 } else if (selector->IsStaticGetterNode()) { 11231 } else if (selector->IsStaticGetterNode()) {
11246 selector->AsStaticGetterNode()->set_is_deferred(is_deferred); 11232 selector->AsStaticGetterNode()->set_is_deferred(is_deferred);
11247 } 11233 }
11248 } 11234 }
11249 } 11235 }
11250 } else if (CurrentToken() == Token::kLBRACK) { 11236 } else if (CurrentToken() == Token::kLBRACK) {
(...skipping 2817 matching lines...) Expand 10 before | Expand all | Expand 10 after
14068 void Parser::SkipQualIdent() { 14054 void Parser::SkipQualIdent() {
14069 ASSERT(IsIdentifier()); 14055 ASSERT(IsIdentifier());
14070 ConsumeToken(); 14056 ConsumeToken();
14071 if (CurrentToken() == Token::kPERIOD) { 14057 if (CurrentToken() == Token::kPERIOD) {
14072 ConsumeToken(); // Consume the kPERIOD token. 14058 ConsumeToken(); // Consume the kPERIOD token.
14073 ExpectIdentifier("identifier expected after '.'"); 14059 ExpectIdentifier("identifier expected after '.'");
14074 } 14060 }
14075 } 14061 }
14076 14062
14077 } // namespace dart 14063 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698