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/builder/scope.dart' show Scope; | |
17 | |
18 import 'package:front_end/src/fasta/kernel/kernel_builder.dart' | 16 import 'package:front_end/src/fasta/kernel/kernel_builder.dart' |
19 show Builder, KernelFormalParameterBuilder; | 17 show Builder, KernelFormalParameterBuilder, Scope; |
20 | 18 |
21 import 'element_store.dart' show ElementStore; | 19 import 'element_store.dart' show ElementStore; |
22 | 20 |
23 export 'ast_builder.dart' show AstBuilder; | 21 export 'ast_builder.dart' show AstBuilder; |
24 | 22 |
25 export 'element_store.dart' show ElementStore; | 23 export 'element_store.dart' show ElementStore; |
26 | 24 |
27 TreeNode toKernel( | 25 TreeNode toKernel( |
28 AstNode node, ElementStore store, Library library, Scope scope) { | 26 AstNode node, ElementStore store, Library library, Scope scope) { |
29 ExpressionScope expressionScope = new ExpressionScope(store, library); | 27 ExpressionScope expressionScope = new ExpressionScope(store, library); |
30 scope.local.forEach((String name, Builder builder) { | 28 scope.local.forEach((String name, Builder builder) { |
31 if (builder is KernelFormalParameterBuilder) { | 29 if (builder is KernelFormalParameterBuilder) { |
32 LocalElement local = store[builder]; | 30 LocalElement local = store[builder]; |
33 assert(local != null); | 31 assert(local != null); |
34 assert(builder.declaration != null); | 32 assert(builder.declaration != null); |
35 expressionScope.localVariables[local] = builder.declaration; | 33 expressionScope.localVariables[local] = builder.declaration; |
36 } | 34 } |
37 }); | 35 }); |
38 return expressionScope.buildStatement(node); | 36 return expressionScope.buildStatement(node); |
39 } | 37 } |
OLD | NEW |