| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 if (field.initializer != null) { | 117 if (field.initializer != null) { |
| 118 visitNode(field.initializer); | 118 visitNode(field.initializer); |
| 119 if (!field.isInstanceMember && | 119 if (!field.isInstanceMember && |
| 120 !field.isConst && | 120 !field.isConst && |
| 121 field.initializer is! ir.NullLiteral) { | 121 field.initializer is! ir.NullLiteral) { |
| 122 impactBuilder.registerFeature(Feature.LAZY_FIELD); | 122 impactBuilder.registerFeature(Feature.LAZY_FIELD); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 if (field.isInstanceMember && | 125 if (field.isInstanceMember && |
| 126 elementAdapter.isNativeClass(field.enclosingClass)) { | 126 elementAdapter.isNativeClass(field.enclosingClass)) { |
| 127 // TODO(johnniwinther): Provide the correct value for [isJsInterop]. | 127 // TODO(redemption): Provide the correct value for [isJsInterop]. |
| 128 impactBuilder.registerNativeData(elementAdapter | 128 impactBuilder.registerNativeData(elementAdapter |
| 129 .getNativeBehaviorForFieldLoad(field, isJsInterop: false)); | 129 .getNativeBehaviorForFieldLoad(field, isJsInterop: false)); |
| 130 impactBuilder.registerNativeData( | 130 impactBuilder.registerNativeData( |
| 131 elementAdapter.getNativeBehaviorForFieldStore(field)); | 131 elementAdapter.getNativeBehaviorForFieldStore(field)); |
| 132 } | 132 } |
| 133 return impactBuilder; | 133 return impactBuilder; |
| 134 } | 134 } |
| 135 | 135 |
| 136 ResolutionImpact buildConstructor(ir.Constructor constructor) { | 136 ResolutionImpact buildConstructor(ir.Constructor constructor) { |
| 137 handleSignature(constructor.function, checkReturnType: false); | 137 handleSignature(constructor.function, checkReturnType: false); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 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)) { |
| 168 // TODO(johnniwinther): Provide the correct value for [isJsInterop]. | 168 // TODO(redemption): Provide the correct value for [isJsInterop]. |
| 169 impactBuilder.registerNativeData(elementAdapter | 169 impactBuilder.registerNativeData(elementAdapter |
| 170 .getNativeBehaviorForMethod(procedure, isJsInterop: false)); | 170 .getNativeBehaviorForMethod(procedure, isJsInterop: false)); |
| 171 } | 171 } |
| 172 return impactBuilder; | 172 return impactBuilder; |
| 173 } | 173 } |
| 174 | 174 |
| 175 void visitNode(ir.Node node) => node?.accept(this); | 175 void visitNode(ir.Node node) => node?.accept(this); |
| 176 | 176 |
| 177 void visitNodes(Iterable<ir.Node> nodes) { | 177 void visitNodes(Iterable<ir.Node> nodes) { |
| 178 nodes.forEach(visitNode); | 178 nodes.forEach(visitNode); |
| (...skipping 433 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 |