| 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 KernelBlock block(List<Statement> statements, Token beginToken) { | 16 KernelBlock block(List<Statement> statements, Token beginToken) { |
| 17 return new KernelBlock(statements)..fileOffset = offsetForToken(beginToken); | 17 return new KernelBlock(statements)..fileOffset = offsetForToken(beginToken); |
| 18 } | 18 } |
| 19 | 19 |
| 20 @override | 20 @override |
| 21 ExpressionStatement expressionStatement(Expression expression) { | 21 ExpressionStatement expressionStatement(Expression expression) { |
| 22 return new KernelExpressionStatement(expression); | 22 return new KernelExpressionStatement(expression); |
| 23 } | 23 } |
| 24 | 24 |
| 25 @override | 25 @override |
| 26 Field field(Name name, int charOffset, {String fileUri}) { | |
| 27 return new KernelField(name, fileUri: fileUri)..fileOffset = charOffset; | |
| 28 } | |
| 29 | |
| 30 @override | |
| 31 FunctionExpression functionExpression(FunctionNode function, Token token) { | 26 FunctionExpression functionExpression(FunctionNode function, Token token) { |
| 32 return new KernelFunctionExpression(function) | 27 return new KernelFunctionExpression(function) |
| 33 ..fileOffset = offsetForToken(token); | 28 ..fileOffset = offsetForToken(token); |
| 34 } | 29 } |
| 35 | 30 |
| 36 @override | 31 @override |
| 37 Statement ifStatement( | 32 Statement ifStatement( |
| 38 Expression condition, Statement thenPart, Statement elsePart) { | 33 Expression condition, Statement thenPart, Statement elsePart) { |
| 39 return new KernelIfStatement(condition, thenPart, elsePart); | 34 return new KernelIfStatement(condition, thenPart, elsePart); |
| 40 } | 35 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 @override | 94 @override |
| 100 VariableGet variableGet( | 95 VariableGet variableGet( |
| 101 VariableDeclaration variable, | 96 VariableDeclaration variable, |
| 102 TypePromotionFact<VariableDeclaration> fact, | 97 TypePromotionFact<VariableDeclaration> fact, |
| 103 TypePromotionScope scope, | 98 TypePromotionScope scope, |
| 104 Token token) { | 99 Token token) { |
| 105 return new KernelVariableGet(variable, fact, scope) | 100 return new KernelVariableGet(variable, fact, scope) |
| 106 ..fileOffset = offsetForToken(token); | 101 ..fileOffset = offsetForToken(token); |
| 107 } | 102 } |
| 108 } | 103 } |
| OLD | NEW |