Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: pkg/analyzer/test/dart/element/builder_test.dart

Issue 2966313002: Remove ExecutableElement.localVariables altogether. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 analyzer.test.dart.element.builder_test; 5 library analyzer.test.dart.element.builder_test;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; 8 import 'package:analyzer/dart/ast/standard_ast_factory.dart';
9 import 'package:analyzer/dart/ast/token.dart'; 9 import 'package:analyzer/dart/ast/token.dart';
10 import 'package:analyzer/dart/element/element.dart'; 10 import 'package:analyzer/dart/element/element.dart';
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 .accept(new ApiElementBuilder(holder, compilationUnitElement)); 1014 .accept(new ApiElementBuilder(holder, compilationUnitElement));
1015 main = holder.functions.single as FunctionElementImpl; 1015 main = holder.functions.single as FunctionElementImpl;
1016 } 1016 }
1017 expect(main.functions, isEmpty); 1017 expect(main.functions, isEmpty);
1018 1018
1019 // Build local elements in body. 1019 // Build local elements in body.
1020 ElementHolder holder = new ElementHolder(); 1020 ElementHolder holder = new ElementHolder();
1021 FunctionBody mainBody = mainAst.functionExpression.body; 1021 FunctionBody mainBody = mainAst.functionExpression.body;
1022 mainBody.accept(new LocalElementBuilder(holder, compilationUnitElement)); 1022 mainBody.accept(new LocalElementBuilder(holder, compilationUnitElement));
1023 main.functions = holder.functions; 1023 main.functions = holder.functions;
1024 main.localVariables = holder.localVariables; 1024 main.encloseElements(holder.localVariables);
1025 1025
1026 var v1 = findLocalVariable(code, 'v1;'); 1026 var v1 = findLocalVariable(code, 'v1;');
1027 var v2 = findLocalVariable(code, 'v2;'); 1027 var v2 = findLocalVariable(code, 'v2;');
1028 var v3 = findLocalVariable(code, 'v3;'); 1028 var v3 = findLocalVariable(code, 'v3;');
1029 1029
1030 expect(v1.enclosingElement, main); 1030 expect(v1.enclosingElement, main);
1031 expect(main.functions, hasLength(1)); 1031 expect(main.functions, hasLength(1));
1032 { 1032 {
1033 FunctionElement f1 = main.functions[0]; 1033 FunctionElement f1 = main.functions[0];
1034 expect(f1.name, 'f1'); 1034 expect(f1.name, 'f1');
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after
2639 AnalysisEngine.instance.logger = logger; 2639 AnalysisEngine.instance.logger = logger;
2640 try { 2640 try {
2641 _compilationUnit = parseCompilationUnit(code); 2641 _compilationUnit = parseCompilationUnit(code);
2642 compilationUnit.accept(visitor); 2642 compilationUnit.accept(visitor);
2643 } finally { 2643 } finally {
2644 expect(logger.log, hasLength(0)); 2644 expect(logger.log, hasLength(0));
2645 AnalysisEngine.instance.logger = Logger.NULL; 2645 AnalysisEngine.instance.logger = Logger.NULL;
2646 } 2646 }
2647 } 2647 }
2648 } 2648 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698