| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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:front_end/src/fasta/kernel/utils.dart'; | 5 import 'package:front_end/src/fasta/kernel/utils.dart'; |
| 6 import 'package:front_end/src/fasta/scanner/token.dart' show Token; | 6 import 'package:front_end/src/fasta/scanner/token.dart' show Token; |
| 7 import 'package:front_end/src/fasta/type_inference/type_promotion.dart'; | 7 import 'package:front_end/src/fasta/type_inference/type_promotion.dart'; |
| 8 import 'package:kernel/ast.dart'; | 8 import 'package:kernel/ast.dart'; |
| 9 | 9 |
| 10 import '../builder/ast_factory.dart'; | 10 import '../builder/ast_factory.dart'; |
| 11 import 'kernel_shadow_ast.dart'; | 11 import 'kernel_shadow_ast.dart'; |
| 12 | 12 |
| 13 /// Concrete implementation of [builder.AstFactory] for building a kernel AST. | 13 /// Concrete implementation of [builder.AstFactory] for building a kernel AST. |
| 14 class KernelAstFactory implements AstFactory<VariableDeclaration> { | 14 class KernelAstFactory implements AstFactory<VariableDeclaration> { |
| 15 @override | 15 @override |
| 16 Arguments arguments(List<Expression> positional, |
| 17 {List<DartType> types, List<NamedExpression> named}) { |
| 18 return new KernelArguments(positional, types: types, named: named); |
| 19 } |
| 20 |
| 21 @override |
| 16 AsExpression asExpression(Expression operand, Token operator, DartType type) { | 22 AsExpression asExpression(Expression operand, Token operator, DartType type) { |
| 17 return new KernelAsExpression(operand, type) | 23 return new KernelAsExpression(operand, type) |
| 18 ..fileOffset = offsetForToken(operator); | 24 ..fileOffset = offsetForToken(operator); |
| 19 } | 25 } |
| 20 | 26 |
| 21 @override | 27 @override |
| 22 AwaitExpression awaitExpression(Token keyword, Expression operand) { | 28 AwaitExpression awaitExpression(Token keyword, Expression operand) { |
| 23 return new KernelAwaitExpression(operand) | 29 return new KernelAwaitExpression(operand) |
| 24 ..fileOffset = offsetForToken(keyword); | 30 ..fileOffset = offsetForToken(keyword); |
| 25 } | 31 } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 return new KernelRethrow()..fileOffset = offsetForToken(keyword); | 167 return new KernelRethrow()..fileOffset = offsetForToken(keyword); |
| 162 } | 168 } |
| 163 | 169 |
| 164 @override | 170 @override |
| 165 KernelReturnStatement returnStatement(Expression expression, Token token) { | 171 KernelReturnStatement returnStatement(Expression expression, Token token) { |
| 166 return new KernelReturnStatement(expression) | 172 return new KernelReturnStatement(expression) |
| 167 ..fileOffset = offsetForToken(token); | 173 ..fileOffset = offsetForToken(token); |
| 168 } | 174 } |
| 169 | 175 |
| 170 @override | 176 @override |
| 177 void setExplicitArgumentTypes(Arguments arguments, List<DartType> types) { |
| 178 KernelArguments.setExplicitArgumentTypes(arguments, types); |
| 179 } |
| 180 |
| 181 @override |
| 171 StaticGet staticGet(Member readTarget, Token token) { | 182 StaticGet staticGet(Member readTarget, Token token) { |
| 172 return new KernelStaticGet(readTarget)..fileOffset = offsetForToken(token); | 183 return new KernelStaticGet(readTarget)..fileOffset = offsetForToken(token); |
| 173 } | 184 } |
| 174 | 185 |
| 175 @override | 186 @override |
| 176 StaticInvocation staticInvocation(Procedure target, Arguments arguments, | 187 StaticInvocation staticInvocation(Procedure target, Arguments arguments, |
| 177 {bool isConst: false}) { | 188 {bool isConst: false}) { |
| 178 return new KernelStaticInvocation(target, arguments, isConst: isConst); | 189 return new KernelStaticInvocation(target, arguments, isConst: isConst); |
| 179 } | 190 } |
| 180 | 191 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 Token token) { | 259 Token token) { |
| 249 return new KernelVariableGet(variable, fact, scope) | 260 return new KernelVariableGet(variable, fact, scope) |
| 250 ..fileOffset = offsetForToken(token); | 261 ..fileOffset = offsetForToken(token); |
| 251 } | 262 } |
| 252 | 263 |
| 253 @override | 264 @override |
| 254 VariableSet variableSet(VariableDeclaration variable, Expression value) { | 265 VariableSet variableSet(VariableDeclaration variable, Expression value) { |
| 255 return new KernelVariableSet(variable, value); | 266 return new KernelVariableSet(variable, value); |
| 256 } | 267 } |
| 257 } | 268 } |
| OLD | NEW |