| 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:kernel/ast.dart' show DartType; | 5 import 'package:kernel/ast.dart'; |
| 6 | 6 |
| 7 import '../builder/ast_factory.dart'; | 7 import '../builder/ast_factory.dart'; |
| 8 import '../builder/shadow_ast.dart'; | |
| 9 import 'kernel_shadow_ast.dart'; | 8 import 'kernel_shadow_ast.dart'; |
| 10 | 9 |
| 11 /// Concrete implementation of [builder.AstFactory] for building a kernel AST. | 10 /// Concrete implementation of [builder.AstFactory] for building a kernel AST. |
| 12 class KernelAstFactory implements AstFactory { | 11 class KernelAstFactory implements AstFactory { |
| 13 @override | 12 @override |
| 14 KernelBlock block(List<ShadowStatement> statements, int charOffset) { | 13 KernelBlock block(List<Statement> statements, int charOffset) { |
| 15 return new KernelBlock(statements)..fileOffset = charOffset; | 14 return new KernelBlock(statements)..fileOffset = charOffset; |
| 16 } | 15 } |
| 17 | 16 |
| 18 @override | 17 @override |
| 19 KernelIntLiteral intLiteral(value, int charOffset) { | 18 KernelIntLiteral intLiteral(value, int charOffset) { |
| 20 return new KernelIntLiteral(value)..fileOffset = charOffset; | 19 return new KernelIntLiteral(value)..fileOffset = charOffset; |
| 21 } | 20 } |
| 22 | 21 |
| 23 @override | 22 @override |
| 24 KernelListLiteral listLiteral(List<ShadowExpression> expressions, | 23 KernelListLiteral listLiteral(List<Expression> expressions, |
| 25 DartType typeArgument, bool isConst, int charOffset) { | 24 DartType typeArgument, bool isConst, int charOffset) { |
| 26 return new KernelListLiteral(expressions, | 25 return new KernelListLiteral(expressions, |
| 27 typeArgument: typeArgument, isConst: isConst)..fileOffset = charOffset; | 26 typeArgument: typeArgument, isConst: isConst) |
| 27 ..fileOffset = charOffset; |
| 28 } | 28 } |
| 29 | 29 |
| 30 @override | 30 @override |
| 31 KernelNullLiteral nullLiteral(int charOffset) { | 31 KernelNullLiteral nullLiteral(int charOffset) { |
| 32 return new KernelNullLiteral()..fileOffset = charOffset; | 32 return new KernelNullLiteral()..fileOffset = charOffset; |
| 33 } | 33 } |
| 34 | 34 |
| 35 @override | 35 @override |
| 36 KernelReturnStatement returnStatement( | 36 KernelReturnStatement returnStatement(Expression expression, int charOffset) { |
| 37 ShadowExpression expression, int charOffset) { | |
| 38 return new KernelReturnStatement(expression)..fileOffset = charOffset; | 37 return new KernelReturnStatement(expression)..fileOffset = charOffset; |
| 39 } | 38 } |
| 40 | 39 |
| 41 @override | 40 @override |
| 42 KernelVariableDeclaration variableDeclaration(String name, | 41 KernelVariableDeclaration variableDeclaration(String name, |
| 43 {DartType type, | 42 {DartType type, |
| 44 ShadowExpression initializer, | 43 Expression initializer, |
| 45 int charOffset, | 44 int charOffset, |
| 46 bool isFinal: false, | 45 bool isFinal: false, |
| 47 bool isConst: false}) { | 46 bool isConst: false}) { |
| 48 return new KernelVariableDeclaration(name, | 47 return new KernelVariableDeclaration(name, |
| 49 type: type, | 48 type: type, |
| 50 initializer: initializer, | 49 initializer: initializer, |
| 51 isFinal: isFinal, | 50 isFinal: isFinal, |
| 52 isConst: isConst)..fileEqualsOffset = charOffset; | 51 isConst: isConst) |
| 52 ..fileEqualsOffset = charOffset; |
| 53 } | 53 } |
| 54 } | 54 } |
| OLD | NEW |