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 | 7 import 'package:analyzer/analyzer.dart' show AstNode; |
8 AstNode; | |
9 | 8 |
10 import 'package:analyzer/dart/element/element.dart' show | 9 import 'package:analyzer/dart/element/element.dart' show LocalElement; |
11 LocalElement; | |
12 | 10 |
13 import 'package:kernel/analyzer/ast_from_analyzer.dart' show | 11 import 'package:kernel/analyzer/ast_from_analyzer.dart' show ExpressionScope; |
14 ExpressionScope; | |
15 | 12 |
16 import 'package:kernel/ast.dart' show | 13 import 'package:kernel/ast.dart' show Library, TreeNode; |
17 Library, | |
18 TreeNode; | |
19 | 14 |
20 import '../builder/scope.dart' show | 15 import '../builder/scope.dart' show Scope; |
21 Scope; | |
22 | 16 |
23 import '../kernel/kernel_builder.dart' show | 17 import '../kernel/kernel_builder.dart' |
24 Builder, | 18 show Builder, KernelFormalParameterBuilder; |
25 KernelFormalParameterBuilder; | |
26 | 19 |
27 import 'element_store.dart' show | 20 import 'element_store.dart' show ElementStore; |
28 ElementStore; | |
29 | 21 |
30 export 'ast_builder.dart' show | 22 export 'ast_builder.dart' show AstBuilder; |
31 AstBuilder; | |
32 | 23 |
33 export 'element_store.dart' show | 24 export 'element_store.dart' show ElementStore; |
34 ElementStore; | |
35 | 25 |
36 TreeNode toKernel(AstNode node, ElementStore store, Library library, | 26 TreeNode toKernel( |
37 Scope scope) { | 27 AstNode node, ElementStore store, Library library, Scope scope) { |
38 ExpressionScope expressionScope = new ExpressionScope(store, library); | 28 ExpressionScope expressionScope = new ExpressionScope(store, library); |
39 scope.local.forEach((String name, Builder builder) { | 29 scope.local.forEach((String name, Builder builder) { |
40 if (builder is KernelFormalParameterBuilder) { | 30 if (builder is KernelFormalParameterBuilder) { |
41 LocalElement local = store[builder]; | 31 LocalElement local = store[builder]; |
42 assert(local != null); | 32 assert(local != null); |
43 assert(builder.declaration != null); | 33 assert(builder.declaration != null); |
44 expressionScope.localVariables[local] = builder.declaration; | 34 expressionScope.localVariables[local] = builder.declaration; |
45 } | 35 } |
46 }); | 36 }); |
47 return expressionScope.buildStatement(node); | 37 return expressionScope.buildStatement(node); |
48 } | 38 } |
OLD | NEW |