| 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 import 'package:kernel/ast.dart' as ir; | 5 import 'package:kernel/ast.dart' as ir; |
| 6 | 6 |
| 7 import '../constants/expressions.dart'; | 7 import '../constants/expressions.dart'; |
| 8 import 'kernel.dart'; | 8 import 'kernel.dart'; |
| 9 | 9 |
| 10 /// Visitor that converts a [ConstantExpression] into a kernel constant | 10 /// Visitor that converts a [ConstantExpression] into a kernel constant |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 throw new UnimplementedError('${exp.toStructuredText()} is not supported.'); | 87 throw new UnimplementedError('${exp.toStructuredText()} is not supported.'); |
| 88 } | 88 } |
| 89 | 89 |
| 90 @override | 90 @override |
| 91 ir.Node visitSymbol(SymbolConstantExpression exp, Kernel kernel) { | 91 ir.Node visitSymbol(SymbolConstantExpression exp, Kernel kernel) { |
| 92 throw new UnimplementedError('${exp.toStructuredText()} is not supported.'); | 92 throw new UnimplementedError('${exp.toStructuredText()} is not supported.'); |
| 93 } | 93 } |
| 94 | 94 |
| 95 @override | 95 @override |
| 96 ir.Node visitConcatenate(ConcatenateConstantExpression exp, Kernel kernel) { | 96 ir.Node visitConcatenate(ConcatenateConstantExpression exp, Kernel kernel) { |
| 97 throw new UnimplementedError('${exp.toStructuredText()} is not supported.'); | 97 return new ir.StringConcatenation( |
| 98 exp.expressions.map((e) => visit(e, kernel)).toList()); |
| 98 } | 99 } |
| 99 | 100 |
| 100 @override | 101 @override |
| 101 ir.Node visitConstructed(ConstructedConstantExpression exp, Kernel kernel) { | 102 ir.Node visitConstructed(ConstructedConstantExpression exp, Kernel kernel) { |
| 102 List<ir.Expression> positional = <ir.Expression>[]; | 103 List<ir.Expression> positional = <ir.Expression>[]; |
| 103 List<ir.NamedExpression> named = <ir.NamedExpression>[]; | 104 List<ir.NamedExpression> named = <ir.NamedExpression>[]; |
| 104 int positionalCount = exp.callStructure.positionalArgumentCount; | 105 int positionalCount = exp.callStructure.positionalArgumentCount; |
| 105 for (int index = 0; index < positionalCount; index++) { | 106 for (int index = 0; index < positionalCount; index++) { |
| 106 ir.Expression argument = visit(exp.arguments[index], kernel); | 107 ir.Expression argument = visit(exp.arguments[index], kernel); |
| 107 if (index < exp.callStructure.positionalArgumentCount) { | 108 if (index < exp.callStructure.positionalArgumentCount) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 @override | 147 @override |
| 147 ir.Node visitInt(IntConstantExpression exp, Kernel kernel) { | 148 ir.Node visitInt(IntConstantExpression exp, Kernel kernel) { |
| 148 return new ir.IntLiteral(exp.primitiveValue); | 149 return new ir.IntLiteral(exp.primitiveValue); |
| 149 } | 150 } |
| 150 | 151 |
| 151 @override | 152 @override |
| 152 ir.Node visitBool(BoolConstantExpression exp, Kernel kernel) { | 153 ir.Node visitBool(BoolConstantExpression exp, Kernel kernel) { |
| 153 return new ir.BoolLiteral(exp.primitiveValue); | 154 return new ir.BoolLiteral(exp.primitiveValue); |
| 154 } | 155 } |
| 155 } | 156 } |
| OLD | NEW |