| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 const_expression; | 5 library const_expression; |
| 6 | 6 |
| 7 import '../dart2jslib.dart' show Constant, ListConstant, MapConstant, | 7 import '../dart2jslib.dart' show Constant, ListConstant, MapConstant, |
| 8 PrimitiveConstant, ConstructedConstant, TypeConstant, FunctionConstant, | 8 PrimitiveConstant, ConstructedConstant, TypeConstant, FunctionConstant, |
| 9 StringConstant; | 9 StringConstant; |
| 10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 class SymbolConstExp extends ConstExp { | 83 class SymbolConstExp extends ConstExp { |
| 84 final String name; | 84 final String name; |
| 85 | 85 |
| 86 SymbolConstExp(this.name); | 86 SymbolConstExp(this.name); |
| 87 | 87 |
| 88 accept(ConstExpVisitor visitor) => visitor.visitSymbol(this); | 88 accept(ConstExpVisitor visitor) => visitor.visitSymbol(this); |
| 89 } | 89 } |
| 90 | 90 |
| 91 /// Type literal. | 91 /// Type literal. |
| 92 class TypeConstExp extends ConstExp { | 92 class TypeConstExp extends ConstExp { |
| 93 final TypeDeclarationElement element; | 93 /// Either [DynamicType] or a raw [GenericType]. |
| 94 final DartType type; |
| 94 | 95 |
| 95 TypeConstExp(this.element); | 96 TypeConstExp(this.type) { |
| 97 assert(type is GenericType || type is DynamicType); |
| 98 } |
| 96 | 99 |
| 97 accept(ConstExpVisitor visitor) => visitor.visitType(this); | 100 accept(ConstExpVisitor visitor) => visitor.visitType(this); |
| 98 } | 101 } |
| 99 | 102 |
| 100 /// A constant local, top-level, or static variable. | 103 /// A constant local, top-level, or static variable. |
| 101 class VariableConstExp extends ConstExp { | 104 class VariableConstExp extends ConstExp { |
| 102 final VariableElement element; | 105 final VariableElement element; |
| 103 | 106 |
| 104 VariableConstExp(this.element); | 107 VariableConstExp(this.element); |
| 105 | 108 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 129 T visitFunction(FunctionConstExp exp); | 132 T visitFunction(FunctionConstExp exp); |
| 130 } | 133 } |
| 131 | 134 |
| 132 /// Represents the declaration of a constant [element] with value [expression]. | 135 /// Represents the declaration of a constant [element] with value [expression]. |
| 133 class ConstDeclaration { | 136 class ConstDeclaration { |
| 134 final VariableElement element; | 137 final VariableElement element; |
| 135 final ConstExp expression; | 138 final ConstExp expression; |
| 136 | 139 |
| 137 ConstDeclaration(this.element, this.expression); | 140 ConstDeclaration(this.element, this.expression); |
| 138 } | 141 } |
| OLD | NEW |