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 '../closure.dart'; | 7 import '../closure.dart'; |
8 import '../common.dart'; | 8 import '../common.dart'; |
9 import '../common/codegen.dart' show CodegenRegistry; | 9 import '../common/codegen.dart' show CodegenRegistry; |
10 import '../common/names.dart'; | 10 import '../common/names.dart'; |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 _addClassTypeVariablesIfNeeded(functionNode.parent); | 642 _addClassTypeVariablesIfNeeded(functionNode.parent); |
643 } | 643 } |
644 | 644 |
645 // If [functionNode] is `operator==` we explicitly add a null check at the | 645 // If [functionNode] is `operator==` we explicitly add a null check at the |
646 // beginning of the method. This is to avoid having call sites do the null | 646 // beginning of the method. This is to avoid having call sites do the null |
647 // check. | 647 // check. |
648 if (parent is ir.Procedure && | 648 if (parent is ir.Procedure && |
649 parent.kind == ir.ProcedureKind.Operator && | 649 parent.kind == ir.ProcedureKind.Operator && |
650 parent.name.name == '==') { | 650 parent.name.name == '==') { |
651 FunctionEntity method = _elementMap.getMethod(parent); | 651 FunctionEntity method = _elementMap.getMethod(parent); |
652 if (!backend.operatorEqHandlesNullArgument(method)) { | 652 if (!_commonElements.operatorEqHandlesNullArgument(method)) { |
653 handleIf( | 653 handleIf( |
654 visitCondition: () { | 654 visitCondition: () { |
655 HParameterValue parameter = parameters.values.first; | 655 HParameterValue parameter = parameters.values.first; |
656 push(new HIdentity(parameter, graph.addConstantNull(closedWorld), | 656 push(new HIdentity(parameter, graph.addConstantNull(closedWorld), |
657 null, commonMasks.boolType)); | 657 null, commonMasks.boolType)); |
658 }, | 658 }, |
659 visitThen: () { | 659 visitThen: () { |
660 closeAndGotoExit(new HReturn( | 660 closeAndGotoExit(new HReturn( |
661 graph.addConstantBool(false, closedWorld), | 661 graph.addConstantBool(false, closedWorld), |
662 // TODO(redemption): Provider source information like | 662 // TODO(redemption): Provider source information like |
(...skipping 2843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3506 enterBlock.setBlockFlow( | 3506 enterBlock.setBlockFlow( |
3507 new HTryBlockInformation( | 3507 new HTryBlockInformation( |
3508 kernelBuilder.wrapStatementGraph(bodyGraph), | 3508 kernelBuilder.wrapStatementGraph(bodyGraph), |
3509 exception, | 3509 exception, |
3510 kernelBuilder.wrapStatementGraph(catchGraph), | 3510 kernelBuilder.wrapStatementGraph(catchGraph), |
3511 kernelBuilder.wrapStatementGraph(finallyGraph)), | 3511 kernelBuilder.wrapStatementGraph(finallyGraph)), |
3512 exitBlock); | 3512 exitBlock); |
3513 kernelBuilder.inTryStatement = previouslyInTryStatement; | 3513 kernelBuilder.inTryStatement = previouslyInTryStatement; |
3514 } | 3514 } |
3515 } | 3515 } |
OLD | NEW |