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