OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library elements.modelx; | 5 library elements.modelx; |
6 | 6 |
7 import 'common.dart'; | 7 import 'common.dart'; |
8 import 'elements.dart'; | 8 import 'elements.dart'; |
9 import '../constants/expressions.dart'; | 9 import '../constants/expressions.dart'; |
10 import '../constants/constructors.dart'; | 10 import '../constants/constructors.dart'; |
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 importScope.addImport(this, element, import, listener); | 1113 importScope.addImport(this, element, import, listener); |
1114 } | 1114 } |
1115 | 1115 |
1116 accept(ElementVisitor visitor, arg) { | 1116 accept(ElementVisitor visitor, arg) { |
1117 return visitor.visitPrefixElement(this, arg); | 1117 return visitor.visitPrefixElement(this, arg); |
1118 } | 1118 } |
1119 | 1119 |
1120 void markAsDeferred(Import deferredImport) { | 1120 void markAsDeferred(Import deferredImport) { |
1121 _deferredImport = deferredImport; | 1121 _deferredImport = deferredImport; |
1122 } | 1122 } |
| 1123 |
| 1124 String toString() => '$kind($name)'; |
1123 } | 1125 } |
1124 | 1126 |
1125 class TypedefElementX extends ElementX | 1127 class TypedefElementX extends ElementX |
1126 with AstElementMixin, | 1128 with AstElementMixin, |
1127 AnalyzableElementX, | 1129 AnalyzableElementX, |
1128 TypeDeclarationElementX<TypedefType> | 1130 TypeDeclarationElementX<TypedefType> |
1129 implements TypedefElement { | 1131 implements TypedefElement { |
1130 Typedef cachedNode; | 1132 Typedef cachedNode; |
1131 | 1133 |
1132 /** | 1134 /** |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 message: "Constant has not been computed for $this.")); | 1235 message: "Constant has not been computed for $this.")); |
1234 return constantCache; | 1236 return constantCache; |
1235 } | 1237 } |
1236 | 1238 |
1237 void set constant(ConstantExpression value) { | 1239 void set constant(ConstantExpression value) { |
1238 if (isPatch) { | 1240 if (isPatch) { |
1239 ConstantVariableMixin originVariable = origin; | 1241 ConstantVariableMixin originVariable = origin; |
1240 originVariable.constant = value; | 1242 originVariable.constant = value; |
1241 return null; | 1243 return null; |
1242 } | 1244 } |
1243 assert(invariant(this, constantCache == null || constantCache == value, | 1245 assert(invariant( |
1244 message: "Constant has already been computed for $this.")); | 1246 this, constantCache == null || constantCache == value, |
| 1247 message: "Constant has already been computed for $this. " |
| 1248 "Existing constant: " |
| 1249 "${constantCache != null ? constantCache.getText() : ''}, " |
| 1250 "New constant: ${value != null ? value.getText() : ''}.")); |
1245 constantCache = value; | 1251 constantCache = value; |
1246 } | 1252 } |
1247 } | 1253 } |
1248 | 1254 |
1249 abstract class VariableElementX extends ElementX | 1255 abstract class VariableElementX extends ElementX |
1250 with AstElementMixin, ConstantVariableMixin | 1256 with AstElementMixin, ConstantVariableMixin |
1251 implements VariableElement { | 1257 implements VariableElement { |
1252 final Token token; | 1258 final Token token; |
1253 final VariableList variables; | 1259 final VariableList variables; |
1254 VariableDefinitions definitionsCache; | 1260 VariableDefinitions definitionsCache; |
(...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2892 AstElement get definingElement; | 2898 AstElement get definingElement; |
2893 | 2899 |
2894 bool get hasResolvedAst => definingElement.hasTreeElements; | 2900 bool get hasResolvedAst => definingElement.hasTreeElements; |
2895 | 2901 |
2896 ResolvedAst get resolvedAst { | 2902 ResolvedAst get resolvedAst { |
2897 return new ResolvedAst(declaration, | 2903 return new ResolvedAst(declaration, |
2898 definingElement.node, definingElement.treeElements); | 2904 definingElement.node, definingElement.treeElements); |
2899 } | 2905 } |
2900 | 2906 |
2901 } | 2907 } |
OLD | NEW |