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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 library rasta.kernel_visitor; | 5 library rasta.kernel_visitor; |
6 | 6 |
7 import 'package:kernel/ast.dart' as ir; | 7 import 'package:kernel/ast.dart' as ir; |
8 | 8 |
9 import 'package:kernel/frontend/accessors.dart' show | 9 import 'package:kernel/frontend/accessors.dart' show |
10 Accessor, | 10 Accessor, |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 node.initializer?.asVariableDefinitions(); | 795 node.initializer?.asVariableDefinitions(); |
796 ir.Expression initializer; | 796 ir.Expression initializer; |
797 List<ir.VariableDeclaration> variables; | 797 List<ir.VariableDeclaration> variables; |
798 if (initializers != null) { | 798 if (initializers != null) { |
799 ir.Block block = buildStatementInBlock(initializers, forceBlock: true); | 799 ir.Block block = buildStatementInBlock(initializers, forceBlock: true); |
800 variables = new List<ir.VariableDeclaration>.from(block.statements); | 800 variables = new List<ir.VariableDeclaration>.from(block.statements); |
801 } else { | 801 } else { |
802 if (node.initializer != null) { | 802 if (node.initializer != null) { |
803 initializer = visitForValue(node.initializer); | 803 initializer = visitForValue(node.initializer); |
804 } | 804 } |
805 variables = const <ir.VariableDeclaration>[]; | 805 variables = <ir.VariableDeclaration>[]; |
806 } | 806 } |
807 ir.Expression condition = visitForValue(node.condition); | 807 ir.Expression condition = visitForValue(node.condition); |
808 List<ir.Expression> updates = <ir.Expression>[]; | 808 List<ir.Expression> updates = <ir.Expression>[]; |
809 for (Expression update in node.update) { | 809 for (Expression update in node.update) { |
810 updates.add(visitForEffect(update)); | 810 updates.add(visitForEffect(update)); |
811 } | 811 } |
812 | 812 |
813 JumpTarget jumpTarget = elements.getTargetDefinition(node); | 813 JumpTarget jumpTarget = elements.getTargetDefinition(node); |
814 ir.Statement body = buildContinueTarget( | 814 ir.Statement body = buildContinueTarget( |
815 buildStatementInBlock(node.body), node, jumpTarget); | 815 buildStatementInBlock(node.body), node, jumpTarget); |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1499 } | 1499 } |
1500 | 1500 |
1501 IrFunction buildGenerativeConstructor( | 1501 IrFunction buildGenerativeConstructor( |
1502 ConstructorElement constructor, | 1502 ConstructorElement constructor, |
1503 NodeList parameters, | 1503 NodeList parameters, |
1504 Node body) { | 1504 Node body) { |
1505 List<ir.Initializer> constructorInitializers = <ir.Initializer>[]; | 1505 List<ir.Initializer> constructorInitializers = <ir.Initializer>[]; |
1506 if (kernel.hasHierarchyProblem(constructor.enclosingClass)) { | 1506 if (kernel.hasHierarchyProblem(constructor.enclosingClass)) { |
1507 constructorInitializers.add(new ir.InvalidInitializer()); | 1507 constructorInitializers.add(new ir.InvalidInitializer()); |
1508 } else if (constructor.isSynthesized) { | 1508 } else if (constructor.isSynthesized) { |
1509 List<ir.Expression> arguments = const <ir.Expression>[]; | 1509 List<ir.Expression> arguments = <ir.Expression>[]; |
1510 List<ir.NamedExpression> named = const <ir.NamedExpression>[]; | 1510 List<ir.NamedExpression> named = <ir.NamedExpression>[]; |
1511 FunctionSignature signature = constructor.functionSignature; | 1511 FunctionSignature signature = constructor.functionSignature; |
1512 if (signature.parameterCount != 0) { | 1512 if (signature.parameterCount != 0) { |
1513 // Mixin application implicit super call. | 1513 // Mixin application implicit super call. |
1514 arguments = <ir.Expression>[]; | 1514 arguments = <ir.Expression>[]; |
1515 named = <ir.NamedExpression>[]; | 1515 named = <ir.NamedExpression>[]; |
1516 signature.orderedForEachParameter((ParameterElement parameter) { | 1516 signature.orderedForEachParameter((ParameterElement parameter) { |
1517 ir.VariableGet argument = buildLocalGet(parameter); | 1517 ir.VariableGet argument = buildLocalGet(parameter); |
1518 if (parameter.isNamed) { | 1518 if (parameter.isNamed) { |
1519 named.add(new ir.NamedExpression(parameter.name, argument)); | 1519 named.add(new ir.NamedExpression(parameter.name, argument)); |
1520 } else { | 1520 } else { |
(...skipping 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3076 : this(null, true, node, initializers); | 3076 : this(null, true, node, initializers); |
3077 | 3077 |
3078 accept(ir.Visitor v) => throw "unsupported"; | 3078 accept(ir.Visitor v) => throw "unsupported"; |
3079 | 3079 |
3080 visitChildren(ir.Visitor v) => throw "unsupported"; | 3080 visitChildren(ir.Visitor v) => throw "unsupported"; |
3081 | 3081 |
3082 String toString() { | 3082 String toString() { |
3083 return "IrFunction($kind, $isConstructor, $node, $initializers)"; | 3083 return "IrFunction($kind, $isConstructor, $node, $initializers)"; |
3084 } | 3084 } |
3085 } | 3085 } |
OLD | NEW |