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

Side by Side Diff: lib/ast.dart

Issue 2465893002: Add strong mode type checking pass. (Closed)
Patch Set: Clean up some spurious changes Created 4 years, 1 month 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 | lib/type_algebra.dart » ('j') | lib/type_algebra.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after
3642 3642
3643 @override 3643 @override
3644 defaultTreeNode(TreeNode node) { 3644 defaultTreeNode(TreeNode node) {
3645 if (node == child) { 3645 if (node == child) {
3646 return replacement; 3646 return replacement;
3647 } else { 3647 } else {
3648 return node; 3648 return node;
3649 } 3649 }
3650 } 3650 }
3651 } 3651 }
OLDNEW
« no previous file with comments | « no previous file | lib/type_algebra.dart » ('j') | lib/type_algebra.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698