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

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

Issue 1342903002: Fixes for the new task model (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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/lib/src/generated/resolver.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 514f126861d15f9497d65067f8e858642d1fb8cc..366703821dc46e01592a4a44c9fe1ebe69f01c80 100644
--- a/pkg/analyzer/test/src/task/dart_test.dart
+++ b/pkg/analyzer/test/src/task/dart_test.dart
@@ -57,7 +57,6 @@ main() {
runReflectiveTests(PartiallyResolveUnitReferencesTaskTest);
runReflectiveTests(ResolveFunctionBodiesInUnitTaskTest);
runReflectiveTests(ResolveLibraryTypeNamesTaskTest);
-// runReflectiveTests(ResolveUnitReferencesTaskTest);
runReflectiveTests(ResolveUnitTypeNamesTaskTest);
runReflectiveTests(ResolveVariableReferencesTaskTest);
runReflectiveTests(ScanDartTaskTest);
@@ -2361,6 +2360,71 @@ main() {
MethodElement methodElement = invocation.methodName.staticElement;
expect(methodElement, isNull);
}
+
+ test_perform_notResolved() {
+ enableStrongMode();
+ Source source = newSource(
+ '/test.dart',
+ '''
+int A;
+f1() {
+ A;
+}
+var f2 = () {
+ A;
+ void f3() {
+ A;
+ }
+}
+class C {
+ C() {
+ A;
+ }
+ m() {
+ A;
+ }
+}
+''');
+ LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
+ computeResult(target, RESOLVED_UNIT5,
+ matcher: isPartiallyResolveUnitReferencesTask);
+ CompilationUnit unit = outputs[RESOLVED_UNIT5];
+ NodeList<CompilationUnitMember> declarations = unit.declarations;
+
+ void expectReference(BlockFunctionBody body, bool isResolved) {
+ ExpressionStatement statement = body.block.statements[0];
+ SimpleIdentifier reference = statement.expression;
+ expect(reference.staticElement, isResolved ? isNotNull : isNull);
+ }
+ //
+ // The reference to 'A' in 'f1' should not be resolved.
+ //
+ FunctionDeclaration f1 = declarations[1];
+ expectReference(f1.functionExpression.body, false);
+ //
+ // The references to 'A' in 'f2' should be resolved.
+ //
+ TopLevelVariableDeclaration f2 = declarations[2];
+ FunctionExpression expression2 = f2.variables.variables[0].initializer;
+ BlockFunctionBody body2 = expression2.body;
+ expectReference(body2, true);
+
+ FunctionDeclarationStatement statement2 = body2.block.statements[1];
+ BlockFunctionBody innerBody =
+ statement2.functionDeclaration.functionExpression.body;
+ expectReference(innerBody, true);
+ //
+ // The references to 'A' in 'C' should not be resolved.
+ //
+ ClassDeclaration c = declarations[3];
+ NodeList<ClassMember> members = c.members;
+
+ ConstructorDeclaration constructor = members[0];
+ expectReference(constructor.body, false);
+
+ MethodDeclaration method = members[1];
+ expectReference(method.body, false);
+ }
}
@reflectiveTest
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698