| Index: pkg/compiler/lib/src/js/nodes.dart
|
| diff --git a/pkg/compiler/lib/src/js/nodes.dart b/pkg/compiler/lib/src/js/nodes.dart
|
| index 92446fa8bf48b3d4faeefcfa0a2013d7b8ec4343..60b3a85976fcaa55fa3f74680b1c695510d715bf 100644
|
| --- a/pkg/compiler/lib/src/js/nodes.dart
|
| +++ b/pkg/compiler/lib/src/js/nodes.dart
|
| @@ -2,7 +2,7 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| -part of js_ast;
|
| +part of js;
|
|
|
| abstract class NodeVisitor<T> {
|
| T visitProgram(Program node);
|
| @@ -29,6 +29,7 @@ abstract class NodeVisitor<T> {
|
| T visitLiteralStatement(LiteralStatement node);
|
| T visitDartYield(DartYield node);
|
|
|
| + T visitBlob(Blob node);
|
| T visitLiteralExpression(LiteralExpression node);
|
| T visitVariableDeclarationList(VariableDeclarationList node);
|
| T visitAssignment(Assignment node);
|
| @@ -108,6 +109,7 @@ class BaseVisitor<T> implements NodeVisitor<T> {
|
| T visitDefault(Default node) => visitNode(node);
|
|
|
| T visitExpression(Expression node) => visitNode(node);
|
| + T visitBlob(Blob node) => visitExpression(node);
|
| T visitVariableReference(VariableReference node) => visitExpression(node);
|
|
|
| T visitLiteralExpression(LiteralExpression node) => visitExpression(node);
|
| @@ -171,14 +173,10 @@ class BaseVisitor<T> implements NodeVisitor<T> {
|
| T visitDartYield(DartYield node) => visitStatement(node);
|
| }
|
|
|
| -/// This tag interface has no behaviour but must be implemented by any class
|
| -/// that is to be stored on a [Node] as source information.
|
| -abstract class JavaScriptNodeSourceInformation {}
|
| -
|
| abstract class Node {
|
| - JavaScriptNodeSourceInformation get sourceInformation => _sourceInformation;
|
| + SourceInformation get sourceInformation => _sourceInformation;
|
|
|
| - JavaScriptNodeSourceInformation _sourceInformation;
|
| + SourceInformation _sourceInformation;
|
|
|
| accept(NodeVisitor visitor);
|
| void visitChildren(NodeVisitor visitor);
|
| @@ -189,8 +187,7 @@ abstract class Node {
|
|
|
| // Returns a node equivalent to [this], but with new source position and end
|
| // source position.
|
| - Node withSourceInformation(
|
| - JavaScriptNodeSourceInformation sourceInformation) {
|
| + Node withSourceInformation(SourceInformation sourceInformation) {
|
| if (sourceInformation == _sourceInformation) {
|
| return this;
|
| }
|
| @@ -525,8 +522,8 @@ class LiteralStatement extends Statement {
|
| LiteralStatement _clone() => new LiteralStatement(code);
|
| }
|
|
|
| -// Not a real JavaScript node, but represents the yield statement from a dart
|
| -// program translated to JavaScript.
|
| +// Not a real javascript node, but represents the yield statement from a dart
|
| +// program translated to javascript.
|
| class DartYield extends Statement {
|
| final Expression expression;
|
|
|
| @@ -549,6 +546,25 @@ abstract class Expression extends Node {
|
| Statement toStatement() => new ExpressionStatement(this);
|
| }
|
|
|
| +/// Wrap a CodeBuffer as an expression.
|
| +class Blob extends Expression {
|
| + // TODO(ahe): This class is an aid to convert everything to ASTs, remove when
|
| + // not needed anymore.
|
| +
|
| + final CodeBuffer buffer;
|
| +
|
| + Blob(this.buffer);
|
| +
|
| + accept(NodeVisitor visitor) => visitor.visitBlob(this);
|
| +
|
| + void visitChildren(NodeVisitor visitor) {}
|
| +
|
| + Blob _clone() => new Blob(buffer);
|
| +
|
| + int get precedenceLevel => PRIMARY;
|
| +
|
| +}
|
| +
|
| class LiteralExpression extends Expression {
|
| final String template;
|
| final List<Expression> inputs;
|
| @@ -931,12 +947,9 @@ class LiteralString extends Literal {
|
| /**
|
| * Constructs a LiteralString from a string value.
|
| *
|
| - * The constructor does not add the required quotes. If [value] is not
|
| - * surrounded by quotes and property escaped, the resulting object is invalid
|
| - * as a JS value.
|
| - *
|
| - * TODO(sra): Introduce variants for known valid strings that don't allocate a
|
| - * new string just to add quotes.
|
| + * The constructor does not add the required quotes. If [value] is
|
| + * not surrounded by quotes, the resulting object is invalid as a JS
|
| + * value.
|
| */
|
| LiteralString(this.value);
|
|
|
| @@ -945,7 +958,7 @@ class LiteralString extends Literal {
|
| }
|
|
|
| class LiteralNumber extends Literal {
|
| - final String value; // Must be a valid JavaScript number literal.
|
| + final String value;
|
|
|
| LiteralNumber(this.value);
|
|
|
| @@ -1114,7 +1127,7 @@ class RegExpLiteral extends Expression {
|
| /**
|
| * An asynchronous await.
|
| *
|
| - * Not part of JavaScript. We desugar this expression before outputting.
|
| + * Not part of javascript. We desugar this expression before outputting.
|
| * Should only occur in a [Fun] with `asyncModifier` async or asyncStar.
|
| */
|
| class Await extends Expression {
|
|
|