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

Side by Side Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 1467363002: Skip local variable dependepcies. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 test.src.task.dart_test; 5 library test.src.task.dart_test;
6 6
7 import 'package:analyzer/src/context/cache.dart'; 7 import 'package:analyzer/src/context/cache.dart';
8 import 'package:analyzer/src/generated/ast.dart'; 8 import 'package:analyzer/src/generated/ast.dart';
9 import 'package:analyzer/src/generated/constant.dart'; 9 import 'package:analyzer/src/generated/constant.dart';
10 import 'package:analyzer/src/generated/element.dart'; 10 import 'package:analyzer/src/generated/element.dart';
(...skipping 1815 matching lines...) Expand 10 before | Expand all | Expand 10 after
1826 expect(outputs, hasLength(1)); 1826 expect(outputs, hasLength(1));
1827 List<VariableElement> dependencies = 1827 List<VariableElement> dependencies =
1828 outputs[PROPAGABLE_VARIABLE_DEPENDENCIES]; 1828 outputs[PROPAGABLE_VARIABLE_DEPENDENCIES];
1829 expect( 1829 expect(
1830 dependencies, 1830 dependencies,
1831 unorderedEquals([ 1831 unorderedEquals([
1832 getTopLevelVariableElement(unit, 'd1'), 1832 getTopLevelVariableElement(unit, 'd1'),
1833 getTopLevelVariableElement(unit, 'd2') 1833 getTopLevelVariableElement(unit, 'd2')
1834 ])); 1834 ]));
1835 } 1835 }
1836
1837 test_perform_topLevel_ignoreLocal() {
1838 AnalysisTarget source = newSource(
1839 '/test.dart',
1840 '''
1841 final a = () {
1842 const b = 2;
1843 const c = 3;
1844 return b + c;
1845 }() + d;
1846 final d = 4;
1847 ''');
1848 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
1849 computeResult(target, RESOLVED_UNIT5);
1850 CompilationUnit unit = outputs[RESOLVED_UNIT5];
1851 TopLevelVariableElement elementA = getTopLevelVariableElement(unit, 'a');
1852 // compute
1853 computeResult(elementA, PROPAGABLE_VARIABLE_DEPENDENCIES,
1854 matcher: isComputePropagableVariableDependenciesTask);
1855 // verify
1856 expect(outputs, hasLength(1));
1857 List<VariableElement> dependencies =
1858 outputs[PROPAGABLE_VARIABLE_DEPENDENCIES];
1859 expect(
1860 dependencies, unorderedEquals([getTopLevelVariableElement(unit, 'd')]));
1861 }
1836 } 1862 }
1837 1863
1838 @reflectiveTest 1864 @reflectiveTest
1839 class ContainingLibrariesTaskTest extends _AbstractDartTaskTest { 1865 class ContainingLibrariesTaskTest extends _AbstractDartTaskTest {
1840 test_perform_definingCompilationUnit() { 1866 test_perform_definingCompilationUnit() {
1841 AnalysisTarget library = newSource('/test.dart', 'library test;'); 1867 AnalysisTarget library = newSource('/test.dart', 'library test;');
1842 computeResult(library, INCLUDED_PARTS); 1868 computeResult(library, INCLUDED_PARTS);
1843 computeResult(library, CONTAINING_LIBRARIES, 1869 computeResult(library, CONTAINING_LIBRARIES,
1844 matcher: isContainingLibrariesTask); 1870 matcher: isContainingLibrariesTask);
1845 expect(outputs, hasLength(1)); 1871 expect(outputs, hasLength(1));
(...skipping 2721 matching lines...) Expand 10 before | Expand all | Expand 10 after
4567 /** 4593 /**
4568 * Fill [errorListener] with [result] errors in the current [task]. 4594 * Fill [errorListener] with [result] errors in the current [task].
4569 */ 4595 */
4570 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { 4596 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) {
4571 List<AnalysisError> errors = task.outputs[result]; 4597 List<AnalysisError> errors = task.outputs[result];
4572 expect(errors, isNotNull, reason: result.name); 4598 expect(errors, isNotNull, reason: result.name);
4573 errorListener = new GatheringErrorListener(); 4599 errorListener = new GatheringErrorListener();
4574 errorListener.addAll(errors); 4600 errorListener.addAll(errors);
4575 } 4601 }
4576 } 4602 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698