OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 dart2js.typechecker; | 5 library dart2js.typechecker; |
6 | 6 |
7 import 'common/names.dart' show Identifiers; | 7 import 'common/names.dart' show Identifiers; |
8 import 'common/resolution.dart' show Resolution; | 8 import 'common/resolution.dart' show Resolution; |
9 import 'common/tasks.dart' show CompilerTask; | 9 import 'common/tasks.dart' show CompilerTask; |
10 import 'common.dart'; | 10 import 'common.dart'; |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 DartType visitIdentifier(Identifier node) { | 678 DartType visitIdentifier(Identifier node) { |
679 if (node.isThis()) { | 679 if (node.isThis()) { |
680 return thisType; | 680 return thisType; |
681 } else if (node.isSuper()) { | 681 } else if (node.isSuper()) { |
682 return superType; | 682 return superType; |
683 } else { | 683 } else { |
684 TypedElement element = elements[node]; | 684 TypedElement element = elements[node]; |
685 assert(invariant(node, element != null, | 685 assert(invariant(node, element != null, |
686 message: 'Missing element for identifier')); | 686 message: 'Missing element for identifier')); |
687 assert(invariant( | 687 assert(invariant( |
688 node, | 688 node, element.isVariable || element.isParameter || element.isField, |
689 element.isVariable || element.isParameter || element.isField, | |
690 message: 'Unexpected context element ${element}')); | 689 message: 'Unexpected context element ${element}')); |
691 return element.computeType(resolution); | 690 return element.computeType(resolution); |
692 } | 691 } |
693 } | 692 } |
694 | 693 |
695 DartType visitIf(If node) { | 694 DartType visitIf(If node) { |
696 Expression condition = node.condition.expression; | 695 Expression condition = node.condition.expression; |
697 Statement thenPart = node.thenPart; | 696 Statement thenPart = node.thenPart; |
698 | 697 |
699 checkCondition(node.condition); | 698 checkCondition(node.condition); |
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2033 | 2032 |
2034 visitTypedef(Typedef node) { | 2033 visitTypedef(Typedef node) { |
2035 // Do not typecheck [Typedef] nodes. | 2034 // Do not typecheck [Typedef] nodes. |
2036 } | 2035 } |
2037 | 2036 |
2038 visitNode(Node node) { | 2037 visitNode(Node node) { |
2039 reporter.internalError(node, | 2038 reporter.internalError(node, |
2040 'Unexpected node ${node.getObjectDescription()} in the type checker.'); | 2039 'Unexpected node ${node.getObjectDescription()} in the type checker.'); |
2041 } | 2040 } |
2042 } | 2041 } |
OLD | NEW |