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

Side by Side Diff: lib/src/js_ast/nodes.dart

Issue 2249233002: fix #626, add AMD module format and make it default (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: merged Created 4 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 unified diff | Download patch
« no previous file with comments | « lib/src/js_ast/module_transform.dart ('k') | test-main.js » ('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 part of js_ast; 5 part of js_ast;
6 6
7 abstract class NodeVisitor<T> implements TypeRefVisitor<T> { 7 abstract class NodeVisitor<T> implements TypeRefVisitor<T> {
8 T visitProgram(Program node); 8 T visitProgram(Program node);
9 9
10 T visitBlock(Block node); 10 T visitBlock(Block node);
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 String toString() { 297 String toString() {
298 var context = new SimpleJavaScriptPrintingContext(); 298 var context = new SimpleJavaScriptPrintingContext();
299 var opts = new JavaScriptPrintingOptions(allowKeywordsInProperties: true); 299 var opts = new JavaScriptPrintingOptions(allowKeywordsInProperties: true);
300 context.buffer.write('js_ast `'); 300 context.buffer.write('js_ast `');
301 accept(new Printer(opts, context)); 301 accept(new Printer(opts, context));
302 context.buffer.write('`'); 302 context.buffer.write('`');
303 return context.getText(); 303 return context.getText();
304 } 304 }
305 } 305 }
306 306
307 // TODO(jmesserly): rename to Module.
307 class Program extends Node { 308 class Program extends Node {
308 /// Script tag hash-bang, e.g. `#!/usr/bin/env node` 309 /// Script tag hash-bang, e.g. `#!/usr/bin/env node`
309 final String scriptTag; 310 final String scriptTag;
310 311
311 /// Top-level statements in the program. 312 /// Top-level statements in the program.
312 final List<ModuleItem> body; 313 final List<ModuleItem> body;
313 314
314 /// The module's own name. 315 /// The module's own name.
315 /// 316 ///
316 /// This is not used in ES6, but is provided to allow module lowering. 317 /// This is not used in ES6, but is provided to allow module lowering.
(...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 1866
1866 final List<ModuleItem> body; 1867 final List<ModuleItem> body;
1867 Module(this.body, {this.name}); 1868 Module(this.body, {this.name});
1868 1869
1869 accept(NodeVisitor visitor) => visitor.visitModule(this); 1870 accept(NodeVisitor visitor) => visitor.visitModule(this);
1870 void visitChildren(NodeVisitor visitor) { 1871 void visitChildren(NodeVisitor visitor) {
1871 for (ModuleItem item in body) item.accept(visitor); 1872 for (ModuleItem item in body) item.accept(visitor);
1872 } 1873 }
1873 Module _clone() => new Module(body); 1874 Module _clone() => new Module(body);
1874 } 1875 }
OLDNEW
« no previous file with comments | « lib/src/js_ast/module_transform.dart ('k') | test-main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698