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

Side by Side Diff: runtime/vm/ast.h

Issue 10689083: Compile an instance setter call when a static getter is declared, but no field (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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 | « no previous file | runtime/vm/ast.cc » ('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 #ifndef VM_AST_H_ 5 #ifndef VM_AST_H_
6 #define VM_AST_H_ 6 #define VM_AST_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/allocation.h" 9 #include "vm/allocation.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 const String& field_name_; 1284 const String& field_name_;
1285 AstNode* value_; 1285 AstNode* value_;
1286 1286
1287 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceSetterNode); 1287 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceSetterNode);
1288 }; 1288 };
1289 1289
1290 1290
1291 class StaticGetterNode : public AstNode { 1291 class StaticGetterNode : public AstNode {
1292 public: 1292 public:
1293 StaticGetterNode(intptr_t token_pos, 1293 StaticGetterNode(intptr_t token_pos,
1294 AstNode* receiver, // Null if called from static context.
1294 const Class& cls, 1295 const Class& cls,
1295 const String& field_name) 1296 const String& field_name)
1296 : AstNode(token_pos), 1297 : AstNode(token_pos),
1298 receiver_(receiver),
1297 cls_(cls), 1299 cls_(cls),
1298 field_name_(field_name) { 1300 field_name_(field_name) {
1299 ASSERT(cls_.IsZoneHandle()); 1301 ASSERT(cls_.IsZoneHandle());
1300 ASSERT(field_name_.IsZoneHandle()); 1302 ASSERT(field_name_.IsZoneHandle());
1301 ASSERT(field_name_.IsSymbol()); 1303 ASSERT(field_name_.IsSymbol());
1302 } 1304 }
1303 1305
1306 // The receiver is required when transforming this StaticGetterNode issued in
1307 // a non-static context to an InstanceSetterNode. This occurs when no field
1308 // and no setter are declared.
1309 AstNode* receiver() const { return receiver_; }
1304 const Class& cls() const { return cls_; } 1310 const Class& cls() const { return cls_; }
1305 const String& field_name() const { return field_name_; } 1311 const String& field_name() const { return field_name_; }
1306 1312
1307 virtual void VisitChildren(AstNodeVisitor* visitor) const { } 1313 virtual void VisitChildren(AstNodeVisitor* visitor) const { }
1308 1314
1309 virtual AstNode* MakeAssignmentNode(AstNode* rhs); 1315 virtual AstNode* MakeAssignmentNode(AstNode* rhs);
1310 1316
1311 virtual const Instance* EvalConstExpr() const; 1317 virtual const Instance* EvalConstExpr() const;
1312 1318
1313 DECLARE_COMMON_NODE_FUNCTIONS(StaticGetterNode); 1319 DECLARE_COMMON_NODE_FUNCTIONS(StaticGetterNode);
1314 1320
1315 private: 1321 private:
1322 AstNode* receiver_;
1316 const Class& cls_; 1323 const Class& cls_;
1317 const String& field_name_; 1324 const String& field_name_;
1318 1325
1319 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticGetterNode); 1326 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticGetterNode);
1320 }; 1327 };
1321 1328
1322 1329
1323 class StaticSetterNode : public AstNode { 1330 class StaticSetterNode : public AstNode {
1324 public: 1331 public:
1325 StaticSetterNode(intptr_t token_pos, 1332 StaticSetterNode(intptr_t token_pos,
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1674 const LocalVariable& context_var_; 1681 const LocalVariable& context_var_;
1675 1682
1676 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); 1683 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode);
1677 }; 1684 };
1678 1685
1679 } // namespace dart 1686 } // namespace dart
1680 1687
1681 #undef DECLARE_COMMON_NODE_FUNCTIONS 1688 #undef DECLARE_COMMON_NODE_FUNCTIONS
1682 1689
1683 #endif // VM_AST_H_ 1690 #endif // VM_AST_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698