OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Defines static information collected by the type checker and used later by | 5 /// Defines static information collected by the type checker and used later by |
6 /// emitters to generate code. | 6 /// emitters to generate code. |
7 library dev_compiler.src.info; | 7 library dev_compiler.src.info; |
8 | 8 |
9 import 'package:analyzer/src/generated/ast.dart'; | 9 import 'package:analyzer/src/generated/ast.dart'; |
10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/src/generated/element.dart'; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 } | 84 } |
85 | 85 |
86 @override | 86 @override |
87 List cloneNodeList(List list) { | 87 List cloneNodeList(List list) { |
88 var clone = super.cloneNodeList(list); | 88 var clone = super.cloneNodeList(list); |
89 for (int i = 0, len = list.length; i < len; i++) { | 89 for (int i = 0, len = list.length; i < len; i++) { |
90 _cloneProperties(clone[i], list[i]); | 90 _cloneProperties(clone[i], list[i]); |
91 } | 91 } |
92 return clone; | 92 return clone; |
93 } | 93 } |
| 94 |
| 95 // TODO(jmesserly): as a workaround for analyzer <0.26.0-alpha.1. |
| 96 // ResolutionCopier won't copy the type, so we do it here. |
| 97 @override |
| 98 AwaitExpression visitAwaitExpression(AwaitExpression node) { |
| 99 var clone = super.visitAwaitExpression(node); |
| 100 clone.staticType = node.staticType; |
| 101 clone.propagatedType = node.propagatedType; |
| 102 return clone; |
| 103 } |
94 } | 104 } |
95 | 105 |
96 // The abstract type of coercions mapping one type to another. | 106 // The abstract type of coercions mapping one type to another. |
97 // This class also exposes static builder functions which | 107 // This class also exposes static builder functions which |
98 // check for errors and reduce redundant coercions to the identity. | 108 // check for errors and reduce redundant coercions to the identity. |
99 abstract class Coercion { | 109 abstract class Coercion { |
100 final DartType fromType; | 110 final DartType fromType; |
101 final DartType toType; | 111 final DartType toType; |
102 Coercion(this.fromType, this.toType); | 112 Coercion(this.fromType, this.toType); |
103 static Coercion cast(DartType fromT, DartType toT) => new Cast(fromT, toT); | 113 static Coercion cast(DartType fromT, DartType toT) => new Cast(fromT, toT); |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 /// Better to have `super` at the end, as required by the Dart style guide: | 582 /// Better to have `super` at the end, as required by the Dart style guide: |
573 /// <http://goo.gl/q1T4BB> | 583 /// <http://goo.gl/q1T4BB> |
574 /// | 584 /// |
575 /// For now this is the only pattern we support. | 585 /// For now this is the only pattern we support. |
576 class InvalidSuperInvocation extends StaticError { | 586 class InvalidSuperInvocation extends StaticError { |
577 InvalidSuperInvocation(SuperConstructorInvocation node) : super(node); | 587 InvalidSuperInvocation(SuperConstructorInvocation node) : super(node); |
578 | 588 |
579 @override String get message => "super call must be last in an initializer " | 589 @override String get message => "super call must be last in an initializer " |
580 "list (see http://goo.gl/q1T4BB): {0}"; | 590 "list (see http://goo.gl/q1T4BB): {0}"; |
581 } | 591 } |
OLD | NEW |