OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'package:compiler/src/common.dart'; | 5 import 'package:compiler/src/common.dart'; |
6 import 'package:compiler/src/common_elements.dart'; | 6 import 'package:compiler/src/common_elements.dart'; |
7 import 'package:compiler/src/compiler.dart'; | 7 import 'package:compiler/src/compiler.dart'; |
8 import 'package:compiler/src/elements/elements.dart'; | 8 import 'package:compiler/src/elements/elements.dart'; |
9 import 'package:compiler/src/elements/entities.dart'; | 9 import 'package:compiler/src/elements/entities.dart'; |
10 import 'package:compiler/src/resolution/tree_elements.dart'; | 10 import 'package:compiler/src/resolution/tree_elements.dart'; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 class TypeMaskChecker extends Visitor with AstEnumeratorMixin { | 101 class TypeMaskChecker extends Visitor with AstEnumeratorMixin { |
102 final DiagnosticReporter reporter; | 102 final DiagnosticReporter reporter; |
103 final Map<Id, String> expectedMap; | 103 final Map<Id, String> expectedMap; |
104 final ResolvedAst resolvedAst; | 104 final ResolvedAst resolvedAst; |
105 final GlobalTypeInferenceResults results; | 105 final GlobalTypeInferenceResults results; |
106 final GlobalTypeInferenceElementResult result; | 106 final GlobalTypeInferenceElementResult result; |
107 | 107 |
108 TypeMaskChecker( | 108 TypeMaskChecker( |
109 this.reporter, this.expectedMap, this.resolvedAst, this.results) | 109 this.reporter, this.expectedMap, this.resolvedAst, this.results) |
110 : result = results.resultOf(resolvedAst.element); | 110 : result = results.resultOfMember(resolvedAst.element as MemberElement); |
111 | 111 |
112 TreeElements get elements => resolvedAst.elements; | 112 TreeElements get elements => resolvedAst.elements; |
113 | 113 |
114 void check() { | 114 void check() { |
115 resolvedAst.node.accept(this); | 115 resolvedAst.node.accept(this); |
116 } | 116 } |
117 | 117 |
118 visitNode(Node node) { | 118 visitNode(Node node) { |
119 node.visitChildren(this); | 119 node.visitChildren(this); |
120 } | 120 } |
121 | 121 |
122 void checkElement(AstElement element) { | 122 void checkElement(AstElement element) { |
123 ElementId id = computeElementId(element); | 123 ElementId id = computeElementId(element); |
124 GlobalTypeInferenceElementResult elementResult = results.resultOf(element); | 124 GlobalTypeInferenceElementResult elementResult = |
| 125 results.resultOfElement(element); |
125 TypeMask value = | 126 TypeMask value = |
126 element.isFunction ? elementResult.returnType : elementResult.type; | 127 element.isFunction ? elementResult.returnType : elementResult.type; |
127 String expected = annotationForId(id); | 128 String expected = annotationForId(id); |
128 checkValue(element, expected, value); | 129 checkValue(element, expected, value); |
129 } | 130 } |
130 | 131 |
131 String annotationForId(Id id) { | 132 String annotationForId(Id id) { |
132 if (id == null) return null; | 133 if (id == null) return null; |
133 return expectedMap.remove(id); | 134 return expectedMap.remove(id); |
134 } | 135 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 visitSend(Send node) { | 172 visitSend(Send node) { |
172 checkSend(node); | 173 checkSend(node); |
173 visitNode(node); | 174 visitNode(node); |
174 } | 175 } |
175 | 176 |
176 visitSendSet(SendSet node) { | 177 visitSendSet(SendSet node) { |
177 checkSend(node); | 178 checkSend(node); |
178 visitNode(node); | 179 visitNode(node); |
179 } | 180 } |
180 } | 181 } |
OLD | NEW |