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 file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library fasta.analyzer; | 5 library fasta.analyzer; |
6 | 6 |
7 import 'package:analyzer/analyzer.dart' show AstNode; | 7 import 'package:analyzer/analyzer.dart' show AstNode; |
8 | 8 |
9 import 'package:analyzer/dart/element/element.dart' show LocalElement; | 9 import 'package:analyzer/dart/element/element.dart' show LocalElement; |
10 | 10 |
11 import 'package:analyzer/src/kernel/ast_from_analyzer.dart' | 11 import 'package:analyzer/src/kernel/ast_from_analyzer.dart' |
12 show ExpressionScope; | 12 show ExpressionScope; |
13 | 13 |
14 import 'package:kernel/ast.dart' show Library, TreeNode; | 14 import 'package:kernel/ast.dart' show Library, TreeNode; |
15 | 15 |
16 import 'package:front_end/src/fasta/kernel/kernel_builder.dart' | 16 import 'package:front_end/src/fasta/kernel/kernel_builder.dart' |
17 show Builder, KernelFormalParameterBuilder, Scope; | 17 show Builder, KernelFormalParameterBuilder, Scope; |
18 | 18 |
19 import 'element_store.dart' show ElementStore; | 19 import 'element_store.dart' show ElementStore; |
20 | 20 |
21 export 'ast_builder.dart' show AstBuilder; | 21 export 'ast_builder.dart' show AstBuilder; |
22 | 22 |
23 export 'element_store.dart' show ElementStore; | 23 export 'element_store.dart' show ElementStore; |
24 | 24 |
25 TreeNode toKernel( | 25 TreeNode toKernel( |
26 AstNode node, ElementStore store, Library library, Scope scope) { | 26 AstNode node, ElementStore store, Library library, Scope scope) { |
27 ExpressionScope expressionScope = new ExpressionScope(store, library); | 27 ExpressionScope expressionScope = new ExpressionScope(store, library); |
28 scope.local.forEach((String name, Builder builder) { | 28 scope.forEach((String name, Builder builder) { |
29 if (builder is KernelFormalParameterBuilder) { | 29 if (builder is KernelFormalParameterBuilder) { |
30 LocalElement local = store[builder]; | 30 LocalElement local = store[builder]; |
31 assert(local != null); | 31 assert(local != null); |
32 assert(builder.declaration != null); | 32 assert(builder.declaration != null); |
33 expressionScope.localVariables[local] = builder.declaration; | 33 expressionScope.localVariables[local] = builder.declaration; |
34 } | 34 } |
35 }); | 35 }); |
36 return expressionScope.buildStatement(node); | 36 return expressionScope.buildStatement(node); |
37 } | 37 } |
OLD | NEW |