| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 if (field.initializer != null) { | 116 if (field.initializer != null) { |
| 117 visitNode(field.initializer); | 117 visitNode(field.initializer); |
| 118 if (!field.isInstanceMember && | 118 if (!field.isInstanceMember && |
| 119 !field.isConst && | 119 !field.isConst && |
| 120 field.initializer is! ir.NullLiteral) { | 120 field.initializer is! ir.NullLiteral) { |
| 121 impactBuilder.registerFeature(Feature.LAZY_FIELD); | 121 impactBuilder.registerFeature(Feature.LAZY_FIELD); |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 if (field.isInstanceMember && | 124 if (field.isInstanceMember && |
| 125 elementAdapter.isNativeClass(field.enclosingClass)) { | 125 elementAdapter.isNativeClass(field.enclosingClass)) { |
| 126 impactBuilder.registerNativeData( | 126 // TODO(johnniwinther): Provide the correct value for [isJsInterop]. |
| 127 elementAdapter.getNativeBehaviorForFieldLoad(field)); | 127 impactBuilder.registerNativeData(elementAdapter |
| 128 .getNativeBehaviorForFieldLoad(field, isJsInterop: false)); |
| 128 impactBuilder.registerNativeData( | 129 impactBuilder.registerNativeData( |
| 129 elementAdapter.getNativeBehaviorForFieldStore(field)); | 130 elementAdapter.getNativeBehaviorForFieldStore(field)); |
| 130 } | 131 } |
| 131 return impactBuilder; | 132 return impactBuilder; |
| 132 } | 133 } |
| 133 | 134 |
| 134 ResolutionImpact buildConstructor(ir.Constructor constructor) { | 135 ResolutionImpact buildConstructor(ir.Constructor constructor) { |
| 135 handleSignature(constructor.function, checkReturnType: false); | 136 handleSignature(constructor.function, checkReturnType: false); |
| 136 visitNodes(constructor.initializers); | 137 visitNodes(constructor.initializers); |
| 137 visitNode(constructor.function.body); | 138 visitNode(constructor.function.body); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 156 "Unexpected async marker: ${asyncMarker}"); | 157 "Unexpected async marker: ${asyncMarker}"); |
| 157 } | 158 } |
| 158 } | 159 } |
| 159 | 160 |
| 160 ResolutionImpact buildProcedure(ir.Procedure procedure) { | 161 ResolutionImpact buildProcedure(ir.Procedure procedure) { |
| 161 handleSignature(procedure.function); | 162 handleSignature(procedure.function); |
| 162 visitNode(procedure.function.body); | 163 visitNode(procedure.function.body); |
| 163 handleAsyncMarker(procedure.function.asyncMarker); | 164 handleAsyncMarker(procedure.function.asyncMarker); |
| 164 if (procedure.isExternal && | 165 if (procedure.isExternal && |
| 165 !elementAdapter.isForeignLibrary(procedure.enclosingLibrary)) { | 166 !elementAdapter.isForeignLibrary(procedure.enclosingLibrary)) { |
| 166 impactBuilder.registerNativeData( | 167 // TODO(johnniwinther): Provide the correct value for [isJsInterop]. |
| 167 elementAdapter.getNativeBehaviorForMethod(procedure)); | 168 impactBuilder.registerNativeData(elementAdapter |
| 169 .getNativeBehaviorForMethod(procedure, isJsInterop: false)); |
| 168 } | 170 } |
| 169 return impactBuilder; | 171 return impactBuilder; |
| 170 } | 172 } |
| 171 | 173 |
| 172 void visitNode(ir.Node node) => node?.accept(this); | 174 void visitNode(ir.Node node) => node?.accept(this); |
| 173 | 175 |
| 174 void visitNodes(Iterable<ir.Node> nodes) { | 176 void visitNodes(Iterable<ir.Node> nodes) { |
| 175 nodes.forEach(visitNode); | 177 nodes.forEach(visitNode); |
| 176 } | 178 } |
| 177 | 179 |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 ConstructorEntity target = elementAdapter.getConstructor(node.target); | 597 ConstructorEntity target = elementAdapter.getConstructor(node.target); |
| 596 impactBuilder.registerStaticUse(new StaticUse.superConstructorInvoke( | 598 impactBuilder.registerStaticUse(new StaticUse.superConstructorInvoke( |
| 597 target, elementAdapter.getCallStructure(node.arguments))); | 599 target, elementAdapter.getCallStructure(node.arguments))); |
| 598 } | 600 } |
| 599 | 601 |
| 600 // TODO(johnniwinther): Make this throw and visit child nodes explicitly | 602 // TODO(johnniwinther): Make this throw and visit child nodes explicitly |
| 601 // instead to ensure that we don't visit unwanted parts of the ir. | 603 // instead to ensure that we don't visit unwanted parts of the ir. |
| 602 @override | 604 @override |
| 603 void defaultNode(ir.Node node) => node.visitChildren(this); | 605 void defaultNode(ir.Node node) => node.visitChildren(this); |
| 604 } | 606 } |
| OLD | NEW |