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

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

Issue 10919127: Introduce AST cloning. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
Index: tests/compiler/dart2js/unparser_test.dart
diff --git a/tests/compiler/dart2js/unparser_test.dart b/tests/compiler/dart2js/unparser_test.dart
index 5186a136c9d0d4a83ea5357942289b8446eecd7f..5585df8f971f2335c07e7166ef61d621986c175f 100644
--- a/tests/compiler/dart2js/unparser_test.dart
+++ b/tests/compiler/dart2js/unparser_test.dart
@@ -474,6 +474,19 @@ testFieldTypeOutput() {
testDart2Dart('main(){new A().field;}class B{}class A{B field;}');
}
+class DynoMap implements Map<Element, ElementAst> {
Roman 2012/09/07 08:10:56 I don't understand "DynoMap" name, what does it me
Anton Muhin 2012/09/07 12:26:07 Name is horrible, sorry. I meant that there is no
+ final compiler;
+ DynoMap(this.compiler);
+
+ get resolvedElements => compiler.enqueuer.resolution.resolvedElements;
+ ElementAst operator[](Element element) =>
+ new ElementAst(element.parseNode(compiler), resolvedElements[element]);
+}
+
+PlaceholderCollector collectPlaceholders(compiler, element) =>
+ new PlaceholderCollector(compiler, new Set<String>(), new DynoMap(compiler))
+ ..collect(element);
+
testLocalFunctionPlaceholder() {
var src = '''
main() {
@@ -485,10 +498,7 @@ main() {
compiler.parseScript(src);
FunctionElement mainElement = compiler.mainApp.find(leg.Compiler.MAIN);
compiler.processQueue(compiler.enqueuer.resolution, mainElement);
- PlaceholderCollector collector =
- new PlaceholderCollector(compiler, new Set<String>());
- collector.collect(mainElement,
- compiler.enqueuer.resolution.resolvedElements[mainElement]);
+ PlaceholderCollector collector = collectPlaceholders(compiler, mainElement);
FunctionExpression mainNode = mainElement.parseNode(compiler);
FunctionExpression fooNode = mainNode.body.statements.nodes.head.function;
LocalPlaceholder fooPlaceholder =
@@ -515,9 +525,7 @@ main() {
ClassElement interfaceElement = compiler.mainApp.find(buildSourceString('I'));
interfaceElement.ensureResolved(compiler);
PlaceholderCollector collector =
- new PlaceholderCollector(compiler, new Set<String>());
- collector.collect(interfaceElement,
- compiler.enqueuer.resolution.resolvedElements[interfaceElement]);
+ collectPlaceholders(compiler, interfaceElement);
ClassNode interfaceNode = interfaceElement.parseNode(compiler);
Node defaultTypeNode = interfaceNode.defaultClause.typeName;
ClassElement classElement = compiler.mainApp.find(buildSourceString('C'));

Powered by Google App Engine
This is Rietveld 408576698