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

Unified Diff: tests/compiler/dart2js/mock_compiler.dart

Issue 1942763002: Rebased and retested version of CL 1915123008. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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/compiler/lib/src/tree/nodes.dart ('k') | tests/compiler/dart2js/resolver_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/mock_compiler.dart
diff --git a/tests/compiler/dart2js/mock_compiler.dart b/tests/compiler/dart2js/mock_compiler.dart
index 839c0836978295477bf4ddd274caa8bc21efbdb8..59dc3da662f808682378ca42f4187823349eae3f 100644
--- a/tests/compiler/dart2js/mock_compiler.dart
+++ b/tests/compiler/dart2js/mock_compiler.dart
@@ -11,6 +11,7 @@ import 'package:compiler/compiler.dart' as api;
import 'package:compiler/src/common/names.dart' show
Uris;
import 'package:compiler/src/constants/expressions.dart';
+import 'package:compiler/src/dart_types.dart' show DartType;
import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
import 'package:compiler/src/diagnostics/source_span.dart';
import 'package:compiler/src/diagnostics/spannable.dart';
@@ -224,10 +225,15 @@ class MockCompiler extends Compiler {
TreeElementMapping resolveNodeStatement(Node tree,
ExecutableElement element) {
ResolverVisitor visitor =
- new ResolverVisitor(this, element,
+ new ResolverVisitor(
+ this,
+ element,
new ResolutionRegistry(this,
- new CollectingTreeElements(element)));
- if (visitor.scope is LibraryScope) {
+ new CollectingTreeElements(element)),
+ scope: new MockTypeVariablesScope(
+ element.enclosingElement.buildScope()));
+ if (visitor.scope is LibraryScope ||
+ visitor.scope is MockTypeVariablesScope) {
visitor.scope = new MethodScope(visitor.scope, element);
}
visitor.visit(tree);
@@ -238,9 +244,12 @@ class MockCompiler extends Compiler {
resolverVisitor() {
Element mockElement = new MockElement(mainApp.entryCompilationUnit);
ResolverVisitor visitor =
- new ResolverVisitor(this, mockElement,
- new ResolutionRegistry(this,
- new CollectingTreeElements(mockElement)));
+ new ResolverVisitor(
+ this,
+ mockElement,
+ new ResolutionRegistry(
+ this, new CollectingTreeElements(mockElement)),
+ scope: mockElement.enclosingElement.buildScope());
visitor.scope = new MethodScope(visitor.scope, mockElement);
return visitor;
}
@@ -321,6 +330,13 @@ class CollectingTreeElements extends TreeElementMapping {
}
}
+class MockTypeVariablesScope extends TypeVariablesScope {
+ @override
+ List<DartType> get typeVariables => <DartType>[];
+ MockTypeVariablesScope(Scope parent) : super(parent);
+ String toString() => 'MockTypeVariablesScope($parent)';
+}
+
// The mock compiler does not split the program in output units.
class MockDeferredLoadTask extends DeferredLoadTask {
MockDeferredLoadTask(Compiler compiler) : super(compiler);
« no previous file with comments | « pkg/compiler/lib/src/tree/nodes.dart ('k') | tests/compiler/dart2js/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698