| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 /// ----------------------------------------------------------------------- | 5 /// ----------------------------------------------------------------------- |
| 6 /// ERROR HANDLING | 6 /// ERROR HANDLING |
| 7 /// ----------------------------------------------------------------------- | 7 /// ----------------------------------------------------------------------- |
| 8 /// | 8 /// |
| 9 /// As a rule of thumb, errors that can be detected statically are handled by | 9 /// As a rule of thumb, errors that can be detected statically are handled by |
| 10 /// the frontend, typically by translating the erroneous code into a 'throw' or | 10 /// the frontend, typically by translating the erroneous code into a 'throw' or |
| (...skipping 2232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2243 DartType typeArgument; // Not null, defaults to DynamicType. | 2243 DartType typeArgument; // Not null, defaults to DynamicType. |
| 2244 final List<Expression> expressions; | 2244 final List<Expression> expressions; |
| 2245 | 2245 |
| 2246 ListLiteral(this.expressions, | 2246 ListLiteral(this.expressions, |
| 2247 {this.typeArgument: const DynamicType(), this.isConst: false}) { | 2247 {this.typeArgument: const DynamicType(), this.isConst: false}) { |
| 2248 assert(typeArgument != null); | 2248 assert(typeArgument != null); |
| 2249 setParents(expressions, this); | 2249 setParents(expressions, this); |
| 2250 } | 2250 } |
| 2251 | 2251 |
| 2252 DartType getStaticType(TypeEnvironment types) { | 2252 DartType getStaticType(TypeEnvironment types) { |
| 2253 return types.listType(typeArgument); | 2253 return types.literalListType(typeArgument); |
| 2254 } | 2254 } |
| 2255 | 2255 |
| 2256 accept(ExpressionVisitor v) => v.visitListLiteral(this); | 2256 accept(ExpressionVisitor v) => v.visitListLiteral(this); |
| 2257 | 2257 |
| 2258 visitChildren(Visitor v) { | 2258 visitChildren(Visitor v) { |
| 2259 typeArgument?.accept(v); | 2259 typeArgument?.accept(v); |
| 2260 visitList(expressions, v); | 2260 visitList(expressions, v); |
| 2261 } | 2261 } |
| 2262 | 2262 |
| 2263 transformChildren(Transformer v) { | 2263 transformChildren(Transformer v) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2275 MapLiteral(this.entries, | 2275 MapLiteral(this.entries, |
| 2276 {this.keyType: const DynamicType(), | 2276 {this.keyType: const DynamicType(), |
| 2277 this.valueType: const DynamicType(), | 2277 this.valueType: const DynamicType(), |
| 2278 this.isConst: false}) { | 2278 this.isConst: false}) { |
| 2279 assert(keyType != null); | 2279 assert(keyType != null); |
| 2280 assert(valueType != null); | 2280 assert(valueType != null); |
| 2281 setParents(entries, this); | 2281 setParents(entries, this); |
| 2282 } | 2282 } |
| 2283 | 2283 |
| 2284 DartType getStaticType(TypeEnvironment types) { | 2284 DartType getStaticType(TypeEnvironment types) { |
| 2285 return types.mapType(keyType, valueType); | 2285 return types.literalMapType(keyType, valueType); |
| 2286 } | 2286 } |
| 2287 | 2287 |
| 2288 accept(ExpressionVisitor v) => v.visitMapLiteral(this); | 2288 accept(ExpressionVisitor v) => v.visitMapLiteral(this); |
| 2289 | 2289 |
| 2290 visitChildren(Visitor v) { | 2290 visitChildren(Visitor v) { |
| 2291 keyType?.accept(v); | 2291 keyType?.accept(v); |
| 2292 valueType?.accept(v); | 2292 valueType?.accept(v); |
| 2293 visitList(entries, v); | 2293 visitList(entries, v); |
| 2294 } | 2294 } |
| 2295 | 2295 |
| (...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3612 | 3612 |
| 3613 @override | 3613 @override |
| 3614 defaultTreeNode(TreeNode node) { | 3614 defaultTreeNode(TreeNode node) { |
| 3615 if (node == child) { | 3615 if (node == child) { |
| 3616 return replacement; | 3616 return replacement; |
| 3617 } else { | 3617 } else { |
| 3618 return node; | 3618 return node; |
| 3619 } | 3619 } |
| 3620 } | 3620 } |
| 3621 } | 3621 } |
| OLD | NEW |