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

Unified Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 1125123006: Add a "librarySource" field to CompilationUnitElementImpl. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/test/generated/resolver_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/task/dart_test.dart
diff --git a/pkg/analyzer/test/src/task/dart_test.dart b/pkg/analyzer/test/src/task/dart_test.dart
index 6b64a374ae6cd4a915189fdae0efa11f9f9bd31c..b22b1e597288e32f2bcc0ae941e50e0006c6c7ad 100644
--- a/pkg/analyzer/test/src/task/dart_test.dart
+++ b/pkg/analyzer/test/src/task/dart_test.dart
@@ -1168,12 +1168,13 @@ class ComputeConstantDependenciesTaskTest extends _AbstractDartTaskTest {
const x = y;
const y = 1;
''');
- // First compute the library element for the source.
- _computeResult(source, LIBRARY_ELEMENT1);
- LibraryElement libraryElement = outputs[LIBRARY_ELEMENT1];
+ // First compute the resolved unit for the source.
+ LibrarySpecificUnit librarySpecificUnit =
+ new LibrarySpecificUnit(source, source);
+ _computeResult(librarySpecificUnit, RESOLVED_UNIT1);
+ CompilationUnit unit = outputs[RESOLVED_UNIT1];
// Find the elements for the constants x and y.
- List<PropertyAccessorElement> accessors =
- libraryElement.definingCompilationUnit.accessors;
+ List<PropertyAccessorElement> accessors = unit.element.accessors;
Element x = accessors.firstWhere((PropertyAccessorElement accessor) =>
accessor.isGetter && accessor.name == 'x').variable;
Element y = accessors.firstWhere((PropertyAccessorElement accessor) =>
@@ -1224,12 +1225,13 @@ const x = 1;
EvaluationResultImpl _computeTopLevelVariableConstValue(
String variableName, String content) {
Source source = newSource('/test.dart', content);
- // First compute the library element for the source.
- _computeResult(source, LIBRARY_ELEMENT1);
- LibraryElement libraryElement = outputs[LIBRARY_ELEMENT1];
+ // First compute the resolved unit for the source.
+ LibrarySpecificUnit librarySpecificUnit =
+ new LibrarySpecificUnit(source, source);
+ _computeResult(librarySpecificUnit, RESOLVED_UNIT1);
+ CompilationUnit unit = outputs[RESOLVED_UNIT1];
// Find the element for the given constant.
- List<PropertyAccessorElement> accessors =
- libraryElement.definingCompilationUnit.accessors;
+ List<PropertyAccessorElement> accessors = unit.element.accessors;
Element variableElement = accessors
.firstWhere((PropertyAccessorElement accessor) {
return accessor.isGetter && accessor.name == variableName;
« no previous file with comments | « pkg/analyzer/test/generated/resolver_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698