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

Side by Side Diff: lib/src/checker/rules.dart

Issue 1166163002: remove unused allowConstCast option (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: format Created 5 years, 6 months 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/src/codegen/reify_coercions.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 library dev_compiler.src.checker.rules; 5 library dev_compiler.src.checker.rules;
6 6
7 import 'package:analyzer/src/generated/ast.dart'; 7 import 'package:analyzer/src/generated/ast.dart';
8 import 'package:analyzer/src/generated/element.dart'; 8 import 'package:analyzer/src/generated/element.dart';
9 import 'package:analyzer/src/generated/resolver.dart'; 9 import 'package:analyzer/src/generated/resolver.dart';
10 10
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 final Coercion c = _coerceTo(fromT, toT, options.wrapClosures); 526 final Coercion c = _coerceTo(fromT, toT, options.wrapClosures);
527 if (c is Identity) return null; 527 if (c is Identity) return null;
528 if (c is CoercionError) return new StaticTypeError(this, expr, toT); 528 if (c is CoercionError) return new StaticTypeError(this, expr, toT);
529 var reason = null; 529 var reason = null;
530 if (options.inferDownwards) { 530 if (options.inferDownwards) {
531 var errors = <String>[]; 531 var errors = <String>[];
532 var ok = inferrer.inferExpression(expr, toT, errors); 532 var ok = inferrer.inferExpression(expr, toT, errors);
533 if (ok) return InferredType.create(this, expr, toT); 533 if (ok) return InferredType.create(this, expr, toT);
534 reason = (errors.isNotEmpty) ? errors.first : null; 534 reason = (errors.isNotEmpty) ? errors.first : null;
535 } 535 }
536 if (constContext && !options.allowConstCasts) {
537 reason = (reason == null) ? "Cast not allowed in const context" : reason;
538 return new StaticTypeError(this, expr, toT, reason: reason);
539 }
540 if (c is Cast) return DownCast.create(this, expr, c, reason: reason); 536 if (c is Cast) return DownCast.create(this, expr, c, reason: reason);
541 if (c is Wrapper) return ClosureWrap.create(this, expr, c, toT); 537 if (c is Wrapper) return ClosureWrap.create(this, expr, c, toT);
542 assert(false); 538 assert(false);
543 return null; 539 return null;
544 } 540 }
545 541
546 DartType elementType(Element e) { 542 DartType elementType(Element e) {
547 return (e as dynamic).type; 543 return (e as dynamic).type;
548 } 544 }
549 545
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 var entries = e.entries; 860 var entries = e.entries;
865 bool inferEntry(MapLiteralEntry entry) { 861 bool inferEntry(MapLiteralEntry entry) {
866 return _inferExpression(entry.key, kType, errors) && 862 return _inferExpression(entry.key, kType, errors) &&
867 _inferExpression(entry.value, vType, errors); 863 _inferExpression(entry.value, vType, errors);
868 } 864 }
869 var b = entries.every(inferEntry); 865 var b = entries.every(inferEntry);
870 if (b) annotateMapLiteral(e, targs); 866 if (b) annotateMapLiteral(e, targs);
871 return b; 867 return b;
872 } 868 }
873 } 869 }
OLDNEW
« no previous file with comments | « no previous file | lib/src/codegen/reify_coercions.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698