OLD | NEW |
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.checker; | 5 library dev_compiler.src.checker.checker; |
6 | 6 |
7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
8 import 'package:analyzer/src/generated/ast.dart'; | 8 import 'package:analyzer/src/generated/ast.dart'; |
9 import 'package:analyzer/src/generated/element.dart'; | 9 import 'package:analyzer/src/generated/element.dart'; |
10 import 'package:analyzer/src/generated/scanner.dart' show Token, TokenType; | 10 import 'package:analyzer/src/generated/scanner.dart' show Token, TokenType; |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 } | 687 } |
688 } | 688 } |
689 } | 689 } |
690 } | 690 } |
691 node.visitChildren(this); | 691 node.visitChildren(this); |
692 } | 692 } |
693 | 693 |
694 void _checkRuntimeTypeCheck(AstNode node, TypeName typeName) { | 694 void _checkRuntimeTypeCheck(AstNode node, TypeName typeName) { |
695 var type = getType(typeName); | 695 var type = getType(typeName); |
696 if (!rules.isGroundType(type)) { | 696 if (!rules.isGroundType(type)) { |
697 _recordMessage(new InvalidRuntimeCheckError(node, type)); | 697 _recordMessage(new NonGroundTypeCheckInfo(node, type)); |
698 } | 698 } |
699 } | 699 } |
700 | 700 |
701 @override | 701 @override |
702 void visitAsExpression(AsExpression node) { | 702 void visitAsExpression(AsExpression node) { |
703 // We could do the same check as the IsExpression below, but that is | 703 // We could do the same check as the IsExpression below, but that is |
704 // potentially too conservative. Instead, at runtime, we must fail hard | 704 // potentially too conservative. Instead, at runtime, we must fail hard |
705 // if the Dart as and the DDC as would return different values. | 705 // if the Dart as and the DDC as would return different values. |
706 node.visitChildren(this); | 706 node.visitChildren(this); |
707 } | 707 } |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 if (info is CoercionInfo) { | 918 if (info is CoercionInfo) { |
919 // TODO(jmesserly): if we're run again on the same AST, we'll produce the | 919 // TODO(jmesserly): if we're run again on the same AST, we'll produce the |
920 // same annotations. This should be harmless. This might go away once | 920 // same annotations. This should be harmless. This might go away once |
921 // CodeChecker is integrated better with analyzer, as it will know that | 921 // CodeChecker is integrated better with analyzer, as it will know that |
922 // checking has already been performed. | 922 // checking has already been performed. |
923 // assert(CoercionInfo.get(info.node) == null); | 923 // assert(CoercionInfo.get(info.node) == null); |
924 CoercionInfo.set(info.node, info); | 924 CoercionInfo.set(info.node, info); |
925 } | 925 } |
926 } | 926 } |
927 } | 927 } |
OLD | NEW |