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

Side by Side Diff: tests/compiler/dart2js/unparser2_test.dart

Issue 1408043002: Move native and js interop properties from the element model to the JS backend (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « tests/compiler/dart2js/type_checker_test.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import "package:compiler/src/parser/element_listener.dart";
6 import "package:compiler/src/parser/node_listener.dart"; 7 import "package:compiler/src/parser/node_listener.dart";
7 import "package:compiler/src/parser/parser.dart"; 8 import "package:compiler/src/parser/parser.dart";
8 import "package:compiler/src/scanner/string_scanner.dart"; 9 import "package:compiler/src/scanner/string_scanner.dart";
9 import "package:compiler/src/tokens/token.dart"; 10 import "package:compiler/src/tokens/token.dart";
10 import "package:compiler/src/tree/tree.dart"; 11 import "package:compiler/src/tree/tree.dart";
11 12
12 import "package:compiler/src/diagnostics/diagnostic_listener.dart"; 13 import "package:compiler/src/diagnostics/diagnostic_listener.dart";
13 import "package:compiler/src/elements/elements.dart" 14 import "package:compiler/src/elements/elements.dart"
14 show CompilationUnitElement, 15 show CompilationUnitElement,
15 LibraryElement; 16 LibraryElement;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 85 }
85 86
86 87
87 String doUnparse(String source) { 88 String doUnparse(String source) {
88 MessageCollector diagnosticListener = new MessageCollector(); 89 MessageCollector diagnosticListener = new MessageCollector();
89 Script script = new Script(null, null, null); 90 Script script = new Script(null, null, null);
90 LibraryElement lib = new LibraryElementX(script); 91 LibraryElement lib = new LibraryElementX(script);
91 CompilationUnitElement element = new CompilationUnitElementX(script, lib); 92 CompilationUnitElement element = new CompilationUnitElementX(script, lib);
92 StringScanner scanner = new StringScanner.fromString(source); 93 StringScanner scanner = new StringScanner.fromString(source);
93 Token beginToken = scanner.tokenize(); 94 Token beginToken = scanner.tokenize();
94 NodeListener listener = new NodeListener(diagnosticListener, element); 95 NodeListener listener = new NodeListener(
96 const ScannerOptions(), diagnosticListener, element);
95 Parser parser = new Parser(listener); 97 Parser parser = new Parser(listener);
96 parser.parseUnit(beginToken); 98 parser.parseUnit(beginToken);
97 Node node = listener.popNode(); 99 Node node = listener.popNode();
98 Expect.isTrue(listener.nodes.isEmpty); 100 Expect.isTrue(listener.nodes.isEmpty);
99 return unparse(node); 101 return unparse(node);
100 } 102 }
101 103
102 class MessageCollector extends DiagnosticReporter { 104 class MessageCollector extends DiagnosticReporter {
103 List<String> messages; 105 List<String> messages;
104 MessageCollector() { 106 MessageCollector() {
105 messages = []; 107 messages = [];
106 } 108 }
107 void internalError(node, String reason) { 109 void internalError(node, String reason) {
108 messages.add(reason); 110 messages.add(reason);
109 throw reason; 111 throw reason;
110 } 112 }
111 113
112 void log(message) { 114 void log(message) {
113 messages.add(message); 115 messages.add(message);
114 } 116 }
115 117
116 noSuchMethod(Invocation invocation) => throw 'unsupported operation'; 118 noSuchMethod(Invocation invocation) => throw 'unsupported operation';
117 } 119 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/type_checker_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698