OLD | NEW |
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 import 'package:kernel/ast.dart' as ir; | 5 import 'package:kernel/ast.dart' as ir; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../compiler.dart'; | 8 import '../compiler.dart'; |
9 import '../constants/values.dart'; | 9 import '../constants/values.dart'; |
10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 TypeMask selectorTypeOf(ir.MethodInvocation invocation) { | 138 TypeMask selectorTypeOf(ir.MethodInvocation invocation) { |
139 return TypeMaskFactory.inferredTypeForSelector( | 139 return TypeMaskFactory.inferredTypeForSelector( |
140 getSelector(invocation), typeOfInvocation(invocation), _compiler); | 140 getSelector(invocation), typeOfInvocation(invocation), _compiler); |
141 } | 141 } |
142 | 142 |
143 TypeMask selectorGetterTypeOf(ir.PropertyGet getter) { | 143 TypeMask selectorGetterTypeOf(ir.PropertyGet getter) { |
144 return TypeMaskFactory.inferredTypeForSelector( | 144 return TypeMaskFactory.inferredTypeForSelector( |
145 getGetterSelector(getter), typeOfGet(getter), _compiler); | 145 getGetterSelector(getter), typeOfGet(getter), _compiler); |
146 } | 146 } |
147 | 147 |
| 148 ConstantValue getConstantFor(ir.Node node) { |
| 149 ConstantValue constantValue = |
| 150 _backend.constants.getConstantValueForNode(getNode(node), _elements); |
| 151 assert(invariant(getNode(node), constantValue != null, |
| 152 message: 'No constant computed for $node')); |
| 153 return constantValue; |
| 154 } |
| 155 |
148 bool isIntercepted(ir.Node node) { | 156 bool isIntercepted(ir.Node node) { |
149 Selector selector; | 157 Selector selector; |
150 if (node is ir.PropertyGet) { | 158 if (node is ir.PropertyGet) { |
151 selector = getGetterSelector(node); | 159 selector = getGetterSelector(node); |
152 } else { | 160 } else { |
153 selector = getSelector(node); | 161 selector = getSelector(node); |
154 } | 162 } |
155 return _backend.isInterceptedSelector(selector); | 163 return _backend.isInterceptedSelector(selector); |
156 } | 164 } |
157 | 165 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 @override | 202 @override |
195 DartType visitDynamicType(ir.DynamicType node) { | 203 DartType visitDynamicType(ir.DynamicType node) { |
196 return const DynamicType(); | 204 return const DynamicType(); |
197 } | 205 } |
198 | 206 |
199 @override | 207 @override |
200 DartType visitInvalidType(ir.InvalidType node) { | 208 DartType visitInvalidType(ir.InvalidType node) { |
201 throw new UnimplementedError("Invalid types not currently supported"); | 209 throw new UnimplementedError("Invalid types not currently supported"); |
202 } | 210 } |
203 } | 211 } |
OLD | NEW |