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:js_runtime/shared/embedded_names.dart'; | 5 import 'package:js_runtime/shared/embedded_names.dart'; |
6 import 'package:kernel/ast.dart' as ir; | 6 import 'package:kernel/ast.dart' as ir; |
7 | 7 |
8 import '../closure.dart'; | 8 import '../closure.dart'; |
9 import '../common.dart'; | 9 import '../common.dart'; |
10 import '../compiler.dart'; | 10 import '../compiler.dart'; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 } | 118 } |
119 if (originTarget is MethodElement) { | 119 if (originTarget is MethodElement) { |
120 if (originTarget is ConstructorBodyElement) { | 120 if (originTarget is ConstructorBodyElement) { |
121 ConstructorBodyElement body = originTarget; | 121 ConstructorBodyElement body = originTarget; |
122 originTarget = body.constructor; | 122 originTarget = body.constructor; |
123 } | 123 } |
124 target = kernel.functions[originTarget]; | 124 target = kernel.functions[originTarget]; |
125 // Closures require a lookup one level deeper in the closure class mapper. | 125 // Closures require a lookup one level deeper in the closure class mapper. |
126 if (target == null) { | 126 if (target == null) { |
127 MethodElement originTargetFunction = originTarget; | 127 MethodElement originTargetFunction = originTarget; |
128 ClosureRepresentationInfo classMap = _compiler.closureToClassMapper | 128 ClosureRepresentationInfo classMap = _compiler.closureDataLookup |
129 .getClosureRepresentationInfo(originTargetFunction); | 129 .getClosureRepresentationInfo(originTargetFunction); |
130 if (classMap.closureEntity != null) { | 130 if (classMap.closureEntity != null) { |
131 target = kernel.localFunctions[classMap.closureEntity]; | 131 target = kernel.localFunctions[classMap.closureEntity]; |
132 } | 132 } |
133 } | 133 } |
134 } else if (originTarget is FieldElement) { | 134 } else if (originTarget is FieldElement) { |
135 target = kernel.fields[originTarget]; | 135 target = kernel.fields[originTarget]; |
136 } | 136 } |
137 assert(target != null); | 137 assert(target != null); |
138 return target; | 138 return target; |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 return constructorBody; | 320 return constructorBody; |
321 } | 321 } |
322 | 322 |
323 @override | 323 @override |
324 Spannable getSpannable(MemberEntity member, ir.Node node) { | 324 Spannable getSpannable(MemberEntity member, ir.Node node) { |
325 return getNode(node); | 325 return getNode(node); |
326 } | 326 } |
327 | 327 |
328 @override | 328 @override |
329 LoopClosureRepresentationInfo getClosureRepresentationInfoForLoop( | 329 LoopClosureRepresentationInfo getClosureRepresentationInfoForLoop( |
330 ClosureClassMaps closureClassMaps, ir.TreeNode node) { | 330 ClosureDataLookup closureLookup, ir.TreeNode node) { |
331 return closureClassMaps.getClosureRepresentationInfoForLoop(getNode(node)); | 331 return closureLookup.getClosureRepresentationInfoForLoop(getNode(node)); |
332 } | 332 } |
333 } | 333 } |
334 | 334 |
335 /// Visitor that converts kernel dart types into [ResolutionDartType]. | 335 /// Visitor that converts kernel dart types into [ResolutionDartType]. |
336 class DartTypeConverter extends ir.DartTypeVisitor<ResolutionDartType> { | 336 class DartTypeConverter extends ir.DartTypeVisitor<ResolutionDartType> { |
337 final KernelAstAdapter astAdapter; | 337 final KernelAstAdapter astAdapter; |
338 bool topLevel = true; | 338 bool topLevel = true; |
339 | 339 |
340 DartTypeConverter(this.astAdapter); | 340 DartTypeConverter(this.astAdapter); |
341 | 341 |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 TypeMask selectorTypeOf(Selector selector, TypeMask mask) { | 643 TypeMask selectorTypeOf(Selector selector, TypeMask mask) { |
644 return TypeMaskFactory.inferredTypeForSelector( | 644 return TypeMaskFactory.inferredTypeForSelector( |
645 selector, mask, _globalInferenceResults); | 645 selector, mask, _globalInferenceResults); |
646 } | 646 } |
647 | 647 |
648 TypeMask typeFromNativeBehavior( | 648 TypeMask typeFromNativeBehavior( |
649 native.NativeBehavior nativeBehavior, ClosedWorld closedWorld) { | 649 native.NativeBehavior nativeBehavior, ClosedWorld closedWorld) { |
650 return TypeMaskFactory.fromNativeBehavior(nativeBehavior, closedWorld); | 650 return TypeMaskFactory.fromNativeBehavior(nativeBehavior, closedWorld); |
651 } | 651 } |
652 } | 652 } |
OLD | NEW |