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/expressions.dart'; | 9 import '../constants/expressions.dart'; |
10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
(...skipping 30 matching lines...) Expand all Loading... |
41 final Compiler compiler; | 41 final Compiler compiler; |
42 | 42 |
43 JavaScriptBackend get backend => compiler.backend; | 43 JavaScriptBackend get backend => compiler.backend; |
44 | 44 |
45 ResolutionWorldImpactBuilder impactBuilder; | 45 ResolutionWorldImpactBuilder impactBuilder; |
46 KernelAstAdapter astAdapter; | 46 KernelAstAdapter astAdapter; |
47 | 47 |
48 KernelImpactBuilder(this.function, this.functionElement, this.resolvedAst, | 48 KernelImpactBuilder(this.function, this.functionElement, this.resolvedAst, |
49 this.compiler, Kernel kernel) { | 49 this.compiler, Kernel kernel) { |
50 this.impactBuilder = new ResolutionWorldImpactBuilder('$functionElement'); | 50 this.impactBuilder = new ResolutionWorldImpactBuilder('$functionElement'); |
51 this.astAdapter = new KernelAstAdapter( | 51 this.astAdapter = new KernelAstAdapter(kernel, compiler.backend, |
52 compiler.backend, | 52 resolvedAst, kernel.nodeToAst, kernel.nodeToElement); |
53 resolvedAst, | |
54 kernel.nodeToAst, | |
55 kernel.nodeToElement, | |
56 kernel.fields, | |
57 kernel.functions, | |
58 kernel.classes, | |
59 kernel.libraries); | |
60 } | 53 } |
61 | 54 |
62 ResolutionImpact build() { | 55 ResolutionImpact build() { |
63 if (function.kind == ir.ProcedureKind.Method || | 56 if (function.kind == ir.ProcedureKind.Method || |
64 function.kind == ir.ProcedureKind.Operator) { | 57 function.kind == ir.ProcedureKind.Operator) { |
65 buildMethod(function); | 58 buildMethod(function); |
66 } else { | 59 } else { |
67 compiler.reporter.internalError( | 60 compiler.reporter.internalError( |
68 functionElement, | 61 functionElement, |
69 "Unable to compute resolution impact for this kind of Kernel " | 62 "Unable to compute resolution impact for this kind of Kernel " |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 _visitArguments(invocation.arguments); | 186 _visitArguments(invocation.arguments); |
194 impactBuilder.registerDynamicUse( | 187 impactBuilder.registerDynamicUse( |
195 new DynamicUse(astAdapter.getSelector(invocation), null)); | 188 new DynamicUse(astAdapter.getSelector(invocation), null)); |
196 } | 189 } |
197 | 190 |
198 @override | 191 @override |
199 void visitNot(ir.Not not) { | 192 void visitNot(ir.Not not) { |
200 not.operand.accept(this); | 193 not.operand.accept(this); |
201 } | 194 } |
202 } | 195 } |
OLD | NEW |