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

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

Issue 2683973002: Handle type literals correctly with deferred loading and await. (Closed)
Patch Set: add comment Created 3 years, 10 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 | runtime/vm/ast_transformer.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 RUNTIME_VM_AST_H_ 5 #ifndef RUNTIME_VM_AST_H_
6 #define RUNTIME_VM_AST_H_ 6 #define RUNTIME_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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 436
437 private: 437 private:
438 const Instance& literal_; 438 const Instance& literal_;
439 439
440 DISALLOW_IMPLICIT_CONSTRUCTORS(LiteralNode); 440 DISALLOW_IMPLICIT_CONSTRUCTORS(LiteralNode);
441 }; 441 };
442 442
443 443
444 class TypeNode : public AstNode { 444 class TypeNode : public AstNode {
445 public: 445 public:
446 TypeNode(TokenPosition token_pos, const AbstractType& type) 446 TypeNode(TokenPosition token_pos,
447 : AstNode(token_pos), type_(type) { 447 const AbstractType& type,
448 bool is_deferred_reference = false)
449 : AstNode(token_pos),
450 type_(type),
451 is_deferred_reference_(is_deferred_reference) {
448 ASSERT(type_.IsZoneHandle()); 452 ASSERT(type_.IsZoneHandle());
449 ASSERT(!type_.IsNull()); 453 ASSERT(!type_.IsNull());
450 ASSERT(type_.IsFinalized()); 454 ASSERT(type_.IsFinalized());
451 // A wellformed literal Type must be canonical. 455 // A wellformed literal Type must be canonical.
452 ASSERT(!type_.IsType() || type_.IsMalformedOrMalbounded() || 456 ASSERT(!type_.IsType() || type_.IsMalformedOrMalbounded() ||
453 type_.IsCanonical()); 457 type_.IsCanonical());
454 } 458 }
455 459
456 const AbstractType& type() const { return type_; } 460 const AbstractType& type() const { return type_; }
457 461
458 const char* TypeName() const; 462 const char* TypeName() const;
459 463
460 virtual const Instance* EvalConstExpr() const { 464 virtual const Instance* EvalConstExpr() const {
461 if (!type_.IsInstantiated() || type_.IsMalformedOrMalbounded()) { 465 if (!type_.IsInstantiated() || type_.IsMalformedOrMalbounded()) {
462 return NULL; 466 return NULL;
463 } 467 }
464 return &type(); 468 return &type();
465 } 469 }
466 470
467 virtual void VisitChildren(AstNodeVisitor* visitor) const {} 471 virtual void VisitChildren(AstNodeVisitor* visitor) const {}
468 472
473 bool is_deferred_reference() const { return is_deferred_reference_; }
474 void set_is_deferred_reference(bool value) { is_deferred_reference_ = value; }
475
469 DECLARE_COMMON_NODE_FUNCTIONS(TypeNode); 476 DECLARE_COMMON_NODE_FUNCTIONS(TypeNode);
470 477
471 private: 478 private:
472 const AbstractType& type_; 479 const AbstractType& type_;
480 bool is_deferred_reference_;
473 481
474 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeNode); 482 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeNode);
475 }; 483 };
476 484
477 485
478 class AssignableNode : public AstNode { 486 class AssignableNode : public AstNode {
479 public: 487 public:
480 AssignableNode(TokenPosition token_pos, 488 AssignableNode(TokenPosition token_pos,
481 AstNode* expr, 489 AstNode* expr,
482 const AbstractType& type, 490 const AbstractType& type,
(...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1966 const intptr_t try_index_; 1974 const intptr_t try_index_;
1967 1975
1968 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); 1976 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode);
1969 }; 1977 };
1970 1978
1971 } // namespace dart 1979 } // namespace dart
1972 1980
1973 #undef DECLARE_COMMON_NODE_FUNCTIONS 1981 #undef DECLARE_COMMON_NODE_FUNCTIONS
1974 1982
1975 #endif // RUNTIME_VM_AST_H_ 1983 #endif // RUNTIME_VM_AST_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/ast_transformer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698