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

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

Issue 1484713002: Issue 25030. Fix for searching variable declaration when there is no whitespace after the type. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after
1852 // compute 1852 // compute
1853 computeResult(elementA, PROPAGABLE_VARIABLE_DEPENDENCIES, 1853 computeResult(elementA, PROPAGABLE_VARIABLE_DEPENDENCIES,
1854 matcher: isComputePropagableVariableDependenciesTask); 1854 matcher: isComputePropagableVariableDependenciesTask);
1855 // verify 1855 // verify
1856 expect(outputs, hasLength(1)); 1856 expect(outputs, hasLength(1));
1857 List<VariableElement> dependencies = 1857 List<VariableElement> dependencies =
1858 outputs[PROPAGABLE_VARIABLE_DEPENDENCIES]; 1858 outputs[PROPAGABLE_VARIABLE_DEPENDENCIES];
1859 expect( 1859 expect(
1860 dependencies, unorderedEquals([getTopLevelVariableElement(unit, 'd')])); 1860 dependencies, unorderedEquals([getTopLevelVariableElement(unit, 'd')]));
1861 } 1861 }
1862
1863 test_perform_topLevel_withoutSpaceAfterType() {
1864 AnalysisTarget source = newSource(
1865 '/test.dart',
1866 '''
1867 const List<int>a=[b, c];
1868 const b = 1;
1869 const c = 2;
1870 ''');
1871 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
1872 computeResult(target, RESOLVED_UNIT5);
1873 CompilationUnit unit = outputs[RESOLVED_UNIT5];
1874 TopLevelVariableElement elementA = getTopLevelVariableElement(unit, 'a');
1875 // compute
1876 computeResult(elementA, PROPAGABLE_VARIABLE_DEPENDENCIES,
1877 matcher: isComputePropagableVariableDependenciesTask);
1878 // verify
1879 expect(outputs, hasLength(1));
1880 List<VariableElement> dependencies =
1881 outputs[PROPAGABLE_VARIABLE_DEPENDENCIES];
1882 expect(
1883 dependencies,
1884 unorderedEquals([
1885 getTopLevelVariableElement(unit, 'b'),
1886 getTopLevelVariableElement(unit, 'c')
1887 ]));
1888 }
1862 } 1889 }
1863 1890
1864 @reflectiveTest 1891 @reflectiveTest
1865 class ContainingLibrariesTaskTest extends _AbstractDartTaskTest { 1892 class ContainingLibrariesTaskTest extends _AbstractDartTaskTest {
1866 test_perform_definingCompilationUnit() { 1893 test_perform_definingCompilationUnit() {
1867 AnalysisTarget library = newSource('/test.dart', 'library test;'); 1894 AnalysisTarget library = newSource('/test.dart', 'library test;');
1868 computeResult(library, INCLUDED_PARTS); 1895 computeResult(library, INCLUDED_PARTS);
1869 computeResult(library, CONTAINING_LIBRARIES, 1896 computeResult(library, CONTAINING_LIBRARIES,
1870 matcher: isContainingLibrariesTask); 1897 matcher: isContainingLibrariesTask);
1871 expect(outputs, hasLength(1)); 1898 expect(outputs, hasLength(1));
(...skipping 2748 matching lines...) Expand 10 before | Expand all | Expand 10 after
4620 /** 4647 /**
4621 * Fill [errorListener] with [result] errors in the current [task]. 4648 * Fill [errorListener] with [result] errors in the current [task].
4622 */ 4649 */
4623 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { 4650 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) {
4624 List<AnalysisError> errors = task.outputs[result]; 4651 List<AnalysisError> errors = task.outputs[result];
4625 expect(errors, isNotNull, reason: result.name); 4652 expect(errors, isNotNull, reason: result.name);
4626 errorListener = new GatheringErrorListener(); 4653 errorListener = new GatheringErrorListener();
4627 errorListener.addAll(errors); 4654 errorListener.addAll(errors);
4628 } 4655 }
4629 } 4656 }
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