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

Side by Side Diff: tests/compiler/dart2js/parser_helper.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, 1 month 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 | « pkg/compiler/lib/src/world.dart ('k') | tests/compiler/dart2js/type_checker_test.dart » ('j') | 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 library parser_helper; 5 library parser_helper;
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 8
9 import "package:compiler/src/elements/elements.dart"; 9 import "package:compiler/src/elements/elements.dart";
10 import "package:compiler/src/tree/tree.dart"; 10 import "package:compiler/src/tree/tree.dart";
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 new StringScanner.fromString(text) 92 new StringScanner.fromString(text)
93 .tokenize(); 93 .tokenize();
94 94
95 Node parseBodyCode(String text, Function parseMethod, 95 Node parseBodyCode(String text, Function parseMethod,
96 {DiagnosticReporter reporter}) { 96 {DiagnosticReporter reporter}) {
97 Token tokens = scan(text); 97 Token tokens = scan(text);
98 if (reporter == null) reporter = new LoggerCanceler(); 98 if (reporter == null) reporter = new LoggerCanceler();
99 Uri uri = new Uri(scheme: "source"); 99 Uri uri = new Uri(scheme: "source");
100 Script script = new Script(uri, uri,new MockFile(text)); 100 Script script = new Script(uri, uri,new MockFile(text));
101 LibraryElement library = new LibraryElementX(script); 101 LibraryElement library = new LibraryElementX(script);
102 library.canUseNative = true; 102 NodeListener listener = new NodeListener(
103 NodeListener listener = 103 new ScannerOptions(canUseNative: true),
104 new NodeListener(reporter, library.entryCompilationUnit); 104 reporter, library.entryCompilationUnit);
105 Parser parser = new Parser(listener); 105 Parser parser = new Parser(listener);
106 Token endToken = parseMethod(parser, tokens); 106 Token endToken = parseMethod(parser, tokens);
107 assert(endToken.kind == EOF_TOKEN); 107 assert(endToken.kind == EOF_TOKEN);
108 Node node = listener.popNode(); 108 Node node = listener.popNode();
109 Expect.isNotNull(node); 109 Expect.isNotNull(node);
110 Expect.isTrue(listener.nodes.isEmpty, 'Not empty: ${listener.nodes}'); 110 Expect.isTrue(listener.nodes.isEmpty, 'Not empty: ${listener.nodes}');
111 return node; 111 return node;
112 } 112 }
113 113
114 Node parseStatement(String text) => 114 Node parseStatement(String text) =>
(...skipping 25 matching lines...) Expand all
140 [void registerSource(Uri uri, String source)]) { 140 [void registerSource(Uri uri, String source)]) {
141 Token tokens = scan(text); 141 Token tokens = scan(text);
142 Uri uri = new Uri(scheme: "source", path: '${++sourceCounter}'); 142 Uri uri = new Uri(scheme: "source", path: '${++sourceCounter}');
143 if (registerSource != null) { 143 if (registerSource != null) {
144 registerSource(uri, text); 144 registerSource(uri, text);
145 } 145 }
146 var script = new Script(uri, uri, new MockFile(text)); 146 var script = new Script(uri, uri, new MockFile(text));
147 var unit = new CompilationUnitElementX(script, library); 147 var unit = new CompilationUnitElementX(script, library);
148 int id = 0; 148 int id = 0;
149 DiagnosticReporter reporter = compiler.reporter; 149 DiagnosticReporter reporter = compiler.reporter;
150 ElementListener listener = new ElementListener(reporter, unit, () => id++); 150 ElementListener listener = new ElementListener(
151 compiler.parsing.getScannerOptionsFor(library),
152 reporter, unit, () => id++);
151 PartialParser parser = new PartialParser(listener); 153 PartialParser parser = new PartialParser(listener);
152 reporter.withCurrentElement(unit, () => parser.parseUnit(tokens)); 154 reporter.withCurrentElement(unit, () => parser.parseUnit(tokens));
153 return unit.localMembers; 155 return unit.localMembers;
154 } 156 }
155 157
156 NodeList fullParseUnit(String source, {DiagnosticReporter reporter}) { 158 NodeList fullParseUnit(String source, {DiagnosticReporter reporter}) {
157 return parseBodyCode( 159 return parseBodyCode(
158 source, 160 source,
159 (parser, tokens) => parser.parseUnit(tokens), 161 (parser, tokens) => parser.parseUnit(tokens),
160 reporter: reporter); 162 reporter: reporter);
161 } 163 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/world.dart ('k') | tests/compiler/dart2js/type_checker_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698