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

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

Issue 1263583005: implement exports, fixes #141 (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: rebase Created 5 years, 4 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
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> { 7 abstract class NodeVisitor<T> {
8 T visitProgram(Program node); 8 T visitProgram(Program node);
9 9
10 T visitBlock(Block node); 10 T visitBlock(Block node);
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 var context = new SimpleJavaScriptPrintingContext(); 238 var context = new SimpleJavaScriptPrintingContext();
239 var opts = new JavaScriptPrintingOptions(allowKeywordsInProperties: true); 239 var opts = new JavaScriptPrintingOptions(allowKeywordsInProperties: true);
240 context.buffer.write('js_ast `'); 240 context.buffer.write('js_ast `');
241 accept(new Printer(opts, context)); 241 accept(new Printer(opts, context));
242 context.buffer.write('`'); 242 context.buffer.write('`');
243 return context.getText(); 243 return context.getText();
244 } 244 }
245 } 245 }
246 246
247 class Program extends Node { 247 class Program extends Node {
248 /// Script tag hash-bang, e.g. `#!/usr/bin/env node`
249 final String scriptTag;
250
251 /// Top-level statements in the program.
248 final List<Statement> body; 252 final List<Statement> body;
249 Program(this.body); 253
254 Program(this.body, {this.scriptTag});
250 255
251 accept(NodeVisitor visitor) => visitor.visitProgram(this); 256 accept(NodeVisitor visitor) => visitor.visitProgram(this);
252 void visitChildren(NodeVisitor visitor) { 257 void visitChildren(NodeVisitor visitor) {
253 for (Statement statement in body) statement.accept(visitor); 258 for (Statement statement in body) statement.accept(visitor);
254 } 259 }
255 Program _clone() => new Program(body); 260 Program _clone() => new Program(body);
256 } 261 }
257 262
258 abstract class Statement extends Node { 263 abstract class Statement extends Node {
259 Statement toStatement() => this; 264 Statement toStatement() => this;
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1529 final Expression expression; 1534 final Expression expression;
1530 1535
1531 CommentExpression(this.comment, this.expression); 1536 CommentExpression(this.comment, this.expression);
1532 1537
1533 int get precedenceLevel => PRIMARY; 1538 int get precedenceLevel => PRIMARY;
1534 accept(NodeVisitor visitor) => visitor.visitCommentExpression(this); 1539 accept(NodeVisitor visitor) => visitor.visitCommentExpression(this);
1535 CommentExpression _clone() => new CommentExpression(comment, expression); 1540 CommentExpression _clone() => new CommentExpression(comment, expression);
1536 1541
1537 void visitChildren(NodeVisitor visitor) => expression.accept(visitor); 1542 void visitChildren(NodeVisitor visitor) => expression.accept(visitor);
1538 } 1543 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698