| 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 '../common/names.dart'; | 8 import '../common/names.dart'; |
| 9 import '../compiler.dart'; | 9 import '../compiler.dart'; |
| 10 import '../constants/expressions.dart'; | 10 import '../constants/expressions.dart'; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 case ir.AsyncMarker.SyncStar: | 147 case ir.AsyncMarker.SyncStar: |
| 148 impactBuilder.registerFeature(Feature.SYNC_STAR); | 148 impactBuilder.registerFeature(Feature.SYNC_STAR); |
| 149 break; | 149 break; |
| 150 case ir.AsyncMarker.Async: | 150 case ir.AsyncMarker.Async: |
| 151 impactBuilder.registerFeature(Feature.ASYNC); | 151 impactBuilder.registerFeature(Feature.ASYNC); |
| 152 break; | 152 break; |
| 153 case ir.AsyncMarker.AsyncStar: | 153 case ir.AsyncMarker.AsyncStar: |
| 154 impactBuilder.registerFeature(Feature.ASYNC_STAR); | 154 impactBuilder.registerFeature(Feature.ASYNC_STAR); |
| 155 break; | 155 break; |
| 156 case ir.AsyncMarker.SyncYielding: | 156 case ir.AsyncMarker.SyncYielding: |
| 157 throw new SpannableAssertionFailure(CURRENT_ELEMENT_SPANNABLE, | 157 failedAt(CURRENT_ELEMENT_SPANNABLE, |
| 158 "Unexpected async marker: ${asyncMarker}"); | 158 "Unexpected async marker: ${asyncMarker}"); |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 | 161 |
| 162 ResolutionImpact buildProcedure(ir.Procedure procedure) { | 162 ResolutionImpact buildProcedure(ir.Procedure procedure) { |
| 163 handleSignature(procedure.function); | 163 handleSignature(procedure.function); |
| 164 visitNode(procedure.function.body); | 164 visitNode(procedure.function.body); |
| 165 handleAsyncMarker(procedure.function.asyncMarker); | 165 handleAsyncMarker(procedure.function.asyncMarker); |
| 166 if (procedure.isExternal && | 166 if (procedure.isExternal && |
| 167 !elementAdapter.isForeignLibrary(procedure.enclosingLibrary)) { | 167 !elementAdapter.isForeignLibrary(procedure.enclosingLibrary)) { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 ? new StaticUse.constConstructorInvoke(constructor, callStructure, type) | 292 ? new StaticUse.constConstructorInvoke(constructor, callStructure, type) |
| 293 : new StaticUse.typedConstructorInvoke( | 293 : new StaticUse.typedConstructorInvoke( |
| 294 constructor, callStructure, type)); | 294 constructor, callStructure, type)); |
| 295 if (type.typeArguments.any((DartType type) => !type.isDynamic)) { | 295 if (type.typeArguments.any((DartType type) => !type.isDynamic)) { |
| 296 impactBuilder.registerFeature(Feature.TYPE_VARIABLE_BOUNDS_CHECK); | 296 impactBuilder.registerFeature(Feature.TYPE_VARIABLE_BOUNDS_CHECK); |
| 297 } | 297 } |
| 298 if (isConst && commonElements.isSymbolConstructor(constructor)) { | 298 if (isConst && commonElements.isSymbolConstructor(constructor)) { |
| 299 ConstantValue value = | 299 ConstantValue value = |
| 300 elementAdapter.getConstantValue(node.arguments.positional.first); | 300 elementAdapter.getConstantValue(node.arguments.positional.first); |
| 301 if (!value.isString) { | 301 if (!value.isString) { |
| 302 throw new SpannableAssertionFailure( | 302 failedAt( |
| 303 CURRENT_ELEMENT_SPANNABLE, | 303 CURRENT_ELEMENT_SPANNABLE, |
| 304 "Unexpected constant value in const Symbol(...) call: " | 304 "Unexpected constant value in const Symbol(...) call: " |
| 305 "${value.toStructuredText()}"); | 305 "${value.toStructuredText()}"); |
| 306 } | 306 } |
| 307 StringConstantValue stringValue = value; | 307 StringConstantValue stringValue = value; |
| 308 impactBuilder.registerConstSymbolName(stringValue.primitiveValue); | 308 impactBuilder.registerConstSymbolName(stringValue.primitiveValue); |
| 309 } | 309 } |
| 310 } | 310 } |
| 311 | 311 |
| 312 @override | 312 @override |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 ConstructorEntity target = elementAdapter.getConstructor(node.target); | 612 ConstructorEntity target = elementAdapter.getConstructor(node.target); |
| 613 impactBuilder.registerStaticUse(new StaticUse.superConstructorInvoke( | 613 impactBuilder.registerStaticUse(new StaticUse.superConstructorInvoke( |
| 614 target, elementAdapter.getCallStructure(node.arguments))); | 614 target, elementAdapter.getCallStructure(node.arguments))); |
| 615 } | 615 } |
| 616 | 616 |
| 617 // TODO(johnniwinther): Make this throw and visit child nodes explicitly | 617 // TODO(johnniwinther): Make this throw and visit child nodes explicitly |
| 618 // instead to ensure that we don't visit unwanted parts of the ir. | 618 // instead to ensure that we don't visit unwanted parts of the ir. |
| 619 @override | 619 @override |
| 620 void defaultNode(ir.Node node) => node.visitChildren(this); | 620 void defaultNode(ir.Node node) => node.visitChildren(this); |
| 621 } | 621 } |
| OLD | NEW |