| 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'; |
| 11 import '../constants/expressions.dart'; | 11 import '../constants/expressions.dart'; |
| 12 import '../constants/values.dart'; | 12 import '../constants/values.dart'; |
| 13 import '../common_elements.dart'; | 13 import '../common_elements.dart'; |
| 14 import '../elements/resolution_types.dart'; | 14 import '../elements/resolution_types.dart'; |
| 15 import '../elements/elements.dart'; | 15 import '../elements/elements.dart'; |
| 16 import '../elements/entities.dart'; | 16 import '../elements/entities.dart'; |
| 17 import '../elements/modelx.dart'; | 17 import '../elements/modelx.dart'; |
| 18 import '../elements/types.dart'; | |
| 19 import '../js/js.dart' as js; | 18 import '../js/js.dart' as js; |
| 20 import '../js_backend/js_backend.dart'; | 19 import '../js_backend/js_backend.dart'; |
| 21 import '../kernel/element_adapter.dart'; | 20 import '../kernel/element_adapter.dart'; |
| 22 import '../kernel/kernel.dart'; | 21 import '../kernel/kernel.dart'; |
| 23 import '../kernel/kernel_debug.dart'; | |
| 24 import '../native/native.dart' as native; | 22 import '../native/native.dart' as native; |
| 25 import '../resolution/tree_elements.dart'; | 23 import '../resolution/tree_elements.dart'; |
| 26 import '../tree/tree.dart' as ast; | 24 import '../tree/tree.dart' as ast; |
| 27 import '../types/masks.dart'; | 25 import '../types/masks.dart'; |
| 28 import '../types/types.dart'; | 26 import '../types/types.dart'; |
| 29 import '../universe/selector.dart'; | 27 import '../universe/selector.dart'; |
| 30 import '../universe/side_effects.dart'; | 28 import '../universe/side_effects.dart'; |
| 31 import '../world.dart'; | 29 import '../world.dart'; |
| 32 import 'graph_builder.dart'; | 30 import 'graph_builder.dart'; |
| 33 import 'jump_handler.dart' show SwitchCaseJumpHandler; | 31 import 'jump_handler.dart' show SwitchCaseJumpHandler; |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 return field.constant == null; | 367 return field.constant == null; |
| 370 } | 368 } |
| 371 return false; | 369 return false; |
| 372 } | 370 } |
| 373 | 371 |
| 374 LibraryElement get jsHelperLibrary => _backend.helpers.jsHelperLibrary; | 372 LibraryElement get jsHelperLibrary => _backend.helpers.jsHelperLibrary; |
| 375 | 373 |
| 376 KernelJumpTarget getJumpTarget(ir.TreeNode node, | 374 KernelJumpTarget getJumpTarget(ir.TreeNode node, |
| 377 {bool isContinueTarget: false}) { | 375 {bool isContinueTarget: false}) { |
| 378 return _jumpTargets.putIfAbsent(node, () { | 376 return _jumpTargets.putIfAbsent(node, () { |
| 379 if (node is ir.LabeledStatement && | 377 if (node is ir.LabeledStatement && _jumpTargets.containsKey(node.body)) { |
| 380 _jumpTargets.containsKey((node as ir.LabeledStatement).body)) { | 378 return _jumpTargets[node.body]; |
| 381 return _jumpTargets[(node as ir.LabeledStatement).body]; | |
| 382 } | 379 } |
| 383 return new KernelJumpTarget(node, this, | 380 return new KernelJumpTarget(node, this, |
| 384 makeContinueLabel: isContinueTarget); | 381 makeContinueLabel: isContinueTarget); |
| 385 }); | 382 }); |
| 386 } | 383 } |
| 387 | 384 |
| 388 ir.Procedure get checkDeferredIsLoaded => | 385 ir.Procedure get checkDeferredIsLoaded => |
| 389 kernel.functions[_backend.helpers.checkDeferredIsLoaded]; | 386 kernel.functions[_backend.helpers.checkDeferredIsLoaded]; |
| 390 | 387 |
| 391 TypeMask get checkDeferredIsLoadedType => | 388 TypeMask get checkDeferredIsLoadedType => |
| (...skipping 27 matching lines...) Expand all Loading... |
| 419 | 416 |
| 420 TypeMask get traceFromExceptionType => | 417 TypeMask get traceFromExceptionType => |
| 421 TypeMaskFactory.inferredReturnTypeForElement( | 418 TypeMaskFactory.inferredReturnTypeForElement( |
| 422 _backend.helpers.traceFromException, _globalInferenceResults); | 419 _backend.helpers.traceFromException, _globalInferenceResults); |
| 423 | 420 |
| 424 ir.Procedure get streamIteratorConstructor => | 421 ir.Procedure get streamIteratorConstructor => |
| 425 kernel.functions[_backend.helpers.streamIteratorConstructor]; | 422 kernel.functions[_backend.helpers.streamIteratorConstructor]; |
| 426 | 423 |
| 427 TypeMask get streamIteratorConstructorType => | 424 TypeMask get streamIteratorConstructorType => |
| 428 TypeMaskFactory.inferredReturnTypeForElement( | 425 TypeMaskFactory.inferredReturnTypeForElement( |
| 426 // ignore: UNNECESSARY_CAST |
| 429 _backend.helpers.streamIteratorConstructor as FunctionEntity, | 427 _backend.helpers.streamIteratorConstructor as FunctionEntity, |
| 430 _globalInferenceResults); | 428 _globalInferenceResults); |
| 431 | 429 |
| 432 ir.Procedure get fallThroughError => | 430 ir.Procedure get fallThroughError => |
| 433 kernel.functions[_backend.helpers.fallThroughError]; | 431 kernel.functions[_backend.helpers.fallThroughError]; |
| 434 | 432 |
| 435 TypeMask get fallThroughErrorType => | 433 TypeMask get fallThroughErrorType => |
| 436 TypeMaskFactory.inferredReturnTypeForElement( | 434 TypeMaskFactory.inferredReturnTypeForElement( |
| 437 _backend.helpers.fallThroughError, _globalInferenceResults); | 435 _backend.helpers.fallThroughError, _globalInferenceResults); |
| 438 | 436 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 | 604 |
| 607 ResolutionInterfaceType getInterfaceType(ir.InterfaceType type) => | 605 ResolutionInterfaceType getInterfaceType(ir.InterfaceType type) => |
| 608 getDartType(type); | 606 getDartType(type); |
| 609 | 607 |
| 610 ResolutionInterfaceType createInterfaceType( | 608 ResolutionInterfaceType createInterfaceType( |
| 611 ir.Class cls, List<ir.DartType> typeArguments) { | 609 ir.Class cls, List<ir.DartType> typeArguments) { |
| 612 return new ResolutionInterfaceType( | 610 return new ResolutionInterfaceType( |
| 613 getClass(cls), getDartTypes(typeArguments)); | 611 getClass(cls), getDartTypes(typeArguments)); |
| 614 } | 612 } |
| 615 | 613 |
| 616 @override | |
| 617 InterfaceType getThisType(ir.Class cls) { | |
| 618 return getClass(cls).thisType; | |
| 619 } | |
| 620 | |
| 621 MemberEntity getConstructorBodyEntity(ir.Constructor constructor) { | 614 MemberEntity getConstructorBodyEntity(ir.Constructor constructor) { |
| 622 AstElement element = getElement(constructor); | 615 AstElement element = getElement(constructor); |
| 623 MemberEntity constructorBody = | 616 MemberEntity constructorBody = |
| 624 ConstructorBodyElementX.createFromResolvedAst(element.resolvedAst); | 617 ConstructorBodyElementX.createFromResolvedAst(element.resolvedAst); |
| 625 assert(constructorBody != null); | 618 assert(constructorBody != null); |
| 626 return constructorBody; | 619 return constructorBody; |
| 627 } | 620 } |
| 628 } | 621 } |
| 629 | 622 |
| 630 /// Visitor that converts kernel dart types into [ResolutionDartType]. | 623 /// Visitor that converts kernel dart types into [ResolutionDartType]. |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 JumpTarget continueTarget = | 817 JumpTarget continueTarget = |
| 825 astAdapter.getJumpTarget(switchCase, isContinueTarget: true); | 818 astAdapter.getJumpTarget(switchCase, isContinueTarget: true); |
| 826 assert(continueTarget is KernelJumpTarget); | 819 assert(continueTarget is KernelJumpTarget); |
| 827 targetIndexMap[continueTarget] = switchIndex; | 820 targetIndexMap[continueTarget] = switchIndex; |
| 828 assert(builder.jumpTargets[continueTarget] == null); | 821 assert(builder.jumpTargets[continueTarget] == null); |
| 829 builder.jumpTargets[continueTarget] = this; | 822 builder.jumpTargets[continueTarget] = this; |
| 830 switchIndex++; | 823 switchIndex++; |
| 831 } | 824 } |
| 832 } | 825 } |
| 833 } | 826 } |
| OLD | NEW |