diff --git a/js/js.iml b/js/js.iml
new file mode 100644
index 00000000000..b88b4205c3d
--- /dev/null
+++ b/js/js.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/com/google/dart/compiler/InternalCompilerException.java b/js/src/compiler/InternalCompilerException.java
similarity index 92%
rename from src/com/google/dart/compiler/InternalCompilerException.java
rename to js/src/compiler/InternalCompilerException.java
index 5db265e920a..f2b21a7a5ba 100644
--- a/src/com/google/dart/compiler/InternalCompilerException.java
+++ b/js/src/compiler/InternalCompilerException.java
@@ -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.
-package com.google.dart.compiler;
+package compiler;
/**
* Exception thrown when the compiler encounters an unexpected internal error.
diff --git a/src/com/google/dart/compiler/Source.java b/js/src/compiler/Source.java
similarity index 96%
rename from src/com/google/dart/compiler/Source.java
rename to js/src/compiler/Source.java
index 13e6e16cbdd..b8828150f52 100644
--- a/src/com/google/dart/compiler/Source.java
+++ b/js/src/compiler/Source.java
@@ -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.
-package com.google.dart.compiler;
+package compiler;
import java.io.IOException;
import java.io.Reader;
diff --git a/src/com/google/dart/compiler/backend/js/Cloner.java b/js/src/compiler/backend/js/Cloner.java
similarity index 97%
rename from src/com/google/dart/compiler/backend/js/Cloner.java
rename to js/src/compiler/backend/js/Cloner.java
index fa3447fe168..fcb78d3f262 100644
--- a/src/com/google/dart/compiler/backend/js/Cloner.java
+++ b/js/src/compiler/backend/js/Cloner.java
@@ -24,10 +24,10 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-package com.google.dart.compiler.backend.js;
+package compiler.backend.js;
-import com.google.dart.compiler.InternalCompilerException;
-import com.google.dart.compiler.backend.js.ast.*;
+import compiler.InternalCompilerException;
+import compiler.backend.js.ast.*;
import java.util.ArrayList;
import java.util.List;
diff --git a/src/com/google/dart/compiler/backend/js/JsConstructExpressionVisitor.java b/js/src/compiler/backend/js/JsConstructExpressionVisitor.java
similarity index 96%
rename from src/com/google/dart/compiler/backend/js/JsConstructExpressionVisitor.java
rename to js/src/compiler/backend/js/JsConstructExpressionVisitor.java
index a15af6b44ed..07449942efd 100644
--- a/src/com/google/dart/compiler/backend/js/JsConstructExpressionVisitor.java
+++ b/js/src/compiler/backend/js/JsConstructExpressionVisitor.java
@@ -2,9 +2,9 @@
// 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.
-package com.google.dart.compiler.backend.js;
+package compiler.backend.js;
-import com.google.dart.compiler.backend.js.ast.*;
+import compiler.backend.js.ast.*;
/**
* Searches for method invocations in constructor expressions that would not
diff --git a/src/com/google/dart/compiler/backend/js/JsFirstExpressionVisitor.java b/js/src/compiler/backend/js/JsFirstExpressionVisitor.java
similarity index 96%
rename from src/com/google/dart/compiler/backend/js/JsFirstExpressionVisitor.java
rename to js/src/compiler/backend/js/JsFirstExpressionVisitor.java
index 0fdb8a5032b..b5e5af1f486 100644
--- a/src/com/google/dart/compiler/backend/js/JsFirstExpressionVisitor.java
+++ b/js/src/compiler/backend/js/JsFirstExpressionVisitor.java
@@ -2,9 +2,9 @@
// 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.
-package com.google.dart.compiler.backend.js;
+package compiler.backend.js;
-import com.google.dart.compiler.backend.js.ast.*;
+import compiler.backend.js.ast.*;
/**
* Determines if an expression statement needs to be surrounded by parentheses.
diff --git a/src/com/google/dart/compiler/backend/js/JsNamer.java b/js/src/compiler/backend/js/JsNamer.java
similarity index 88%
rename from src/com/google/dart/compiler/backend/js/JsNamer.java
rename to js/src/compiler/backend/js/JsNamer.java
index 0c49ad05750..b4d497a6263 100644
--- a/src/com/google/dart/compiler/backend/js/JsNamer.java
+++ b/js/src/compiler/backend/js/JsNamer.java
@@ -2,9 +2,9 @@
// 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.
-package com.google.dart.compiler.backend.js;
+package compiler.backend.js;
-import com.google.dart.compiler.backend.js.ast.JsProgram;
+import compiler.backend.js.ast.JsProgram;
/**
* A namer runs through a program and renames the short names of JsNames.
diff --git a/src/com/google/dart/compiler/backend/js/JsNormalizer.java b/js/src/compiler/backend/js/JsNormalizer.java
similarity index 97%
rename from src/com/google/dart/compiler/backend/js/JsNormalizer.java
rename to js/src/compiler/backend/js/JsNormalizer.java
index 04c5530cd42..b614b52a442 100644
--- a/src/com/google/dart/compiler/backend/js/JsNormalizer.java
+++ b/js/src/compiler/backend/js/JsNormalizer.java
@@ -2,9 +2,9 @@
// 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.
-package com.google.dart.compiler.backend.js;
+package compiler.backend.js;
-import com.google.dart.compiler.backend.js.ast.*;
+import compiler.backend.js.ast.*;
/**
* Fixes any semantic errors introduced by JS AST gen.
diff --git a/src/com/google/dart/compiler/backend/js/JsParserException.java b/js/src/compiler/backend/js/JsParserException.java
similarity index 98%
rename from src/com/google/dart/compiler/backend/js/JsParserException.java
rename to js/src/compiler/backend/js/JsParserException.java
index 79b53c1d69e..84432785c65 100644
--- a/src/com/google/dart/compiler/backend/js/JsParserException.java
+++ b/js/src/compiler/backend/js/JsParserException.java
@@ -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.
-package com.google.dart.compiler.backend.js;
+package compiler.backend.js;
/**
* Indicates inability to parse JavaScript source.
diff --git a/src/com/google/dart/compiler/backend/js/JsPrecedenceVisitor.java b/js/src/compiler/backend/js/JsPrecedenceVisitor.java
similarity index 97%
rename from src/com/google/dart/compiler/backend/js/JsPrecedenceVisitor.java
rename to js/src/compiler/backend/js/JsPrecedenceVisitor.java
index 2cc6a3b16ed..2fbed323e6b 100644
--- a/src/com/google/dart/compiler/backend/js/JsPrecedenceVisitor.java
+++ b/js/src/compiler/backend/js/JsPrecedenceVisitor.java
@@ -2,10 +2,10 @@
// 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.
-package com.google.dart.compiler.backend.js;
+package compiler.backend.js;
-import com.google.dart.compiler.backend.js.ast.*;
-import com.google.dart.compiler.backend.js.ast.JsVars.JsVar;
+import compiler.backend.js.ast.JsVars.JsVar;
+import compiler.backend.js.ast.*;
/**
* Precedence indices from "JavaScript - The Definitive Guide" 4th Edition (page
diff --git a/src/com/google/dart/compiler/backend/js/JsPrettyNamer.java b/js/src/compiler/backend/js/JsPrettyNamer.java
similarity index 92%
rename from src/com/google/dart/compiler/backend/js/JsPrettyNamer.java
rename to js/src/compiler/backend/js/JsPrettyNamer.java
index 2c61e01f6b3..e0f5dafcc4a 100644
--- a/src/com/google/dart/compiler/backend/js/JsPrettyNamer.java
+++ b/js/src/compiler/backend/js/JsPrettyNamer.java
@@ -2,12 +2,12 @@
// 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.
-package com.google.dart.compiler.backend.js;
+package compiler.backend.js;
-import com.google.dart.compiler.backend.js.ast.JsName;
-import com.google.dart.compiler.backend.js.ast.JsProgram;
-import com.google.dart.compiler.backend.js.ast.JsRootScope;
-import com.google.dart.compiler.backend.js.ast.JsScope;
+import compiler.backend.js.ast.JsName;
+import compiler.backend.js.ast.JsProgram;
+import compiler.backend.js.ast.JsRootScope;
+import compiler.backend.js.ast.JsScope;
import java.util.*;
diff --git a/src/com/google/dart/compiler/backend/js/JsRequiresSemiVisitor.java b/js/src/compiler/backend/js/JsRequiresSemiVisitor.java
similarity index 96%
rename from src/com/google/dart/compiler/backend/js/JsRequiresSemiVisitor.java
rename to js/src/compiler/backend/js/JsRequiresSemiVisitor.java
index f4095c5c822..23fd588a197 100644
--- a/src/com/google/dart/compiler/backend/js/JsRequiresSemiVisitor.java
+++ b/js/src/compiler/backend/js/JsRequiresSemiVisitor.java
@@ -2,9 +2,9 @@
// 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.
-package com.google.dart.compiler.backend.js;
+package compiler.backend.js;
-import com.google.dart.compiler.backend.js.ast.*;
+import compiler.backend.js.ast.*;
/**
* Determines if a statement at the end of a block requires a semicolon.
diff --git a/src/com/google/dart/compiler/backend/js/JsReservedIdentifiers.java b/js/src/compiler/backend/js/JsReservedIdentifiers.java
similarity index 99%
rename from src/com/google/dart/compiler/backend/js/JsReservedIdentifiers.java
rename to js/src/compiler/backend/js/JsReservedIdentifiers.java
index 56ae5428a3d..1889766557c 100644
--- a/src/com/google/dart/compiler/backend/js/JsReservedIdentifiers.java
+++ b/js/src/compiler/backend/js/JsReservedIdentifiers.java
@@ -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.
-package com.google.dart.compiler.backend.js;
+package compiler.backend.js;
import java.util.HashSet;
import java.util.Set;
diff --git a/src/com/google/dart/compiler/backend/js/JsSourceGenerationVisitor.java b/js/src/compiler/backend/js/JsSourceGenerationVisitor.java
similarity index 70%
rename from src/com/google/dart/compiler/backend/js/JsSourceGenerationVisitor.java
rename to js/src/compiler/backend/js/JsSourceGenerationVisitor.java
index ebb836a7228..b09031ae955 100644
--- a/src/com/google/dart/compiler/backend/js/JsSourceGenerationVisitor.java
+++ b/js/src/compiler/backend/js/JsSourceGenerationVisitor.java
@@ -2,13 +2,13 @@
// 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.
-package com.google.dart.compiler.backend.js;
+package compiler.backend.js;
-import com.google.dart.compiler.backend.js.ast.JsBlock;
-import com.google.dart.compiler.backend.js.ast.JsContext;
-import com.google.dart.compiler.backend.js.ast.JsProgram;
-import com.google.dart.compiler.backend.js.ast.JsProgramFragment;
-import com.google.dart.compiler.util.TextOutput;
+import compiler.backend.js.ast.JsContext;
+import compiler.backend.js.ast.JsProgramFragment;
+import compiler.util.TextOutput;
+import compiler.backend.js.ast.JsBlock;
+import compiler.backend.js.ast.JsProgram;
/**
* Generates JavaScript source from an AST.
diff --git a/src/com/google/dart/compiler/backend/js/JsToStringGenerationVisitor.java b/js/src/compiler/backend/js/JsToStringGenerationVisitor.java
similarity index 99%
rename from src/com/google/dart/compiler/backend/js/JsToStringGenerationVisitor.java
rename to js/src/compiler/backend/js/JsToStringGenerationVisitor.java
index b94d128895e..0c04444df5d 100644
--- a/src/com/google/dart/compiler/backend/js/JsToStringGenerationVisitor.java
+++ b/js/src/compiler/backend/js/JsToStringGenerationVisitor.java
@@ -2,11 +2,10 @@
// 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.
-package com.google.dart.compiler.backend.js;
+package compiler.backend.js;
-import com.google.dart.compiler.backend.js.ast.*;
-import com.google.dart.compiler.backend.js.ast.JsVars.JsVar;
-import com.google.dart.compiler.util.TextOutput;
+import compiler.util.TextOutput;
+import compiler.backend.js.ast.*;
import java.util.*;
import java.util.regex.Pattern;
@@ -880,7 +879,7 @@ public class JsToStringGenerationVisitor extends JsVisitor {
}
@Override
- public boolean visit(JsVar x, JsContext ctx) {
+ public boolean visit(JsVars.JsVar x, JsContext ctx) {
_nameOf(x);
JsExpression initExpr = x.getInitExpr();
if (initExpr != null) {
@@ -899,7 +898,7 @@ public class JsToStringGenerationVisitor extends JsVisitor {
_var();
_space();
boolean sep = false;
- for (JsVar var : x) {
+ for (JsVars.JsVar var : x) {
sep = _sepCommaOptSpace(sep);
accept(var);
}
diff --git a/src/com/google/dart/compiler/backend/js/UncheckedJsParserException.java b/js/src/compiler/backend/js/UncheckedJsParserException.java
similarity index 93%
rename from src/com/google/dart/compiler/backend/js/UncheckedJsParserException.java
rename to js/src/compiler/backend/js/UncheckedJsParserException.java
index c2db8120537..2958a181cc7 100644
--- a/src/com/google/dart/compiler/backend/js/UncheckedJsParserException.java
+++ b/js/src/compiler/backend/js/UncheckedJsParserException.java
@@ -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.
-package com.google.dart.compiler.backend.js;
+package compiler.backend.js;
/**
* An unchecked wrapper exception to interop with Rhino.
diff --git a/src/com/google/dart/compiler/backend/js/ast/CanBooleanEval.java b/js/src/compiler/backend/js/ast/CanBooleanEval.java
similarity index 88%
rename from src/com/google/dart/compiler/backend/js/ast/CanBooleanEval.java
rename to js/src/compiler/backend/js/ast/CanBooleanEval.java
index 8f4364d94f2..6920c53c27c 100644
--- a/src/com/google/dart/compiler/backend/js/ast/CanBooleanEval.java
+++ b/js/src/compiler/backend/js/ast/CanBooleanEval.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* An interface that describes the boolean evaluation of an expression.
diff --git a/src/com/google/dart/compiler/backend/js/ast/HasArguments.java b/js/src/compiler/backend/js/ast/HasArguments.java
similarity index 88%
rename from src/com/google/dart/compiler/backend/js/ast/HasArguments.java
rename to js/src/compiler/backend/js/ast/HasArguments.java
index 5a47c567606..ebcbf1aaa7b 100644
--- a/src/com/google/dart/compiler/backend/js/ast/HasArguments.java
+++ b/js/src/compiler/backend/js/ast/HasArguments.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
import java.util.List;
diff --git a/src/com/google/dart/compiler/backend/js/ast/HasCondition.java b/js/src/compiler/backend/js/ast/HasCondition.java
similarity index 89%
rename from src/com/google/dart/compiler/backend/js/ast/HasCondition.java
rename to js/src/compiler/backend/js/ast/HasCondition.java
index 082f4e15eb3..318476094c6 100644
--- a/src/com/google/dart/compiler/backend/js/ast/HasCondition.java
+++ b/js/src/compiler/backend/js/ast/HasCondition.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Implemented by JavaScript objects with conditional execution.
diff --git a/src/com/google/dart/compiler/backend/js/ast/HasName.java b/js/src/compiler/backend/js/ast/HasName.java
similarity index 87%
rename from src/com/google/dart/compiler/backend/js/ast/HasName.java
rename to js/src/compiler/backend/js/ast/HasName.java
index 8daed3769f4..31af4e91dcc 100644
--- a/src/com/google/dart/compiler/backend/js/ast/HasName.java
+++ b/js/src/compiler/backend/js/ast/HasName.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Implemented by JavaScript objects that have a name.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsArrayAccess.java b/js/src/compiler/backend/js/ast/JsArrayAccess.java
similarity index 96%
rename from src/com/google/dart/compiler/backend/js/ast/JsArrayAccess.java
rename to js/src/compiler/backend/js/ast/JsArrayAccess.java
index 46df5108086..46a9f16b8c5 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsArrayAccess.java
+++ b/js/src/compiler/backend/js/ast/JsArrayAccess.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Represents a javascript expression for array access.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsArrayLiteral.java b/js/src/compiler/backend/js/ast/JsArrayLiteral.java
similarity index 96%
rename from src/com/google/dart/compiler/backend/js/ast/JsArrayLiteral.java
rename to js/src/compiler/backend/js/ast/JsArrayLiteral.java
index 8cb9f7e6d52..8dff0837657 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsArrayLiteral.java
+++ b/js/src/compiler/backend/js/ast/JsArrayLiteral.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
import java.util.ArrayList;
import java.util.List;
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsBinaryOperation.java b/js/src/compiler/backend/js/ast/JsBinaryOperation.java
similarity index 97%
rename from src/com/google/dart/compiler/backend/js/ast/JsBinaryOperation.java
rename to js/src/compiler/backend/js/ast/JsBinaryOperation.java
index b09d50c1d05..54dd2774d50 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsBinaryOperation.java
+++ b/js/src/compiler/backend/js/ast/JsBinaryOperation.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Represents a JavaScript binary operation.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsBinaryOperator.java b/js/src/compiler/backend/js/ast/JsBinaryOperator.java
similarity index 98%
rename from src/com/google/dart/compiler/backend/js/ast/JsBinaryOperator.java
rename to js/src/compiler/backend/js/ast/JsBinaryOperator.java
index b54647f3a46..dd5e9bb469f 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsBinaryOperator.java
+++ b/js/src/compiler/backend/js/ast/JsBinaryOperator.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Represents the operator in a JavaScript binary operation.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsBlock.java b/js/src/compiler/backend/js/ast/JsBlock.java
similarity index 95%
rename from src/com/google/dart/compiler/backend/js/ast/JsBlock.java
rename to js/src/compiler/backend/js/ast/JsBlock.java
index 3d927a2bf7d..65c9c353e46 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsBlock.java
+++ b/js/src/compiler/backend/js/ast/JsBlock.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
import java.util.ArrayList;
import java.util.List;
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsBooleanLiteral.java b/js/src/compiler/backend/js/ast/JsBooleanLiteral.java
similarity index 95%
rename from src/com/google/dart/compiler/backend/js/ast/JsBooleanLiteral.java
rename to js/src/compiler/backend/js/ast/JsBooleanLiteral.java
index 12238ddbb02..69f2487e0f2 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsBooleanLiteral.java
+++ b/js/src/compiler/backend/js/ast/JsBooleanLiteral.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Represents a JavaScript literal boolean expression.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsBreak.java b/js/src/compiler/backend/js/ast/JsBreak.java
similarity index 94%
rename from src/com/google/dart/compiler/backend/js/ast/JsBreak.java
rename to js/src/compiler/backend/js/ast/JsBreak.java
index 363f294df78..da4ecc2044a 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsBreak.java
+++ b/js/src/compiler/backend/js/ast/JsBreak.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Represents the JavaScript break statement.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsCase.java b/js/src/compiler/backend/js/ast/JsCase.java
similarity index 94%
rename from src/com/google/dart/compiler/backend/js/ast/JsCase.java
rename to js/src/compiler/backend/js/ast/JsCase.java
index 43d2fc41230..67968695cbd 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsCase.java
+++ b/js/src/compiler/backend/js/ast/JsCase.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Represents the JavaScript case statement.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsCatch.java b/js/src/compiler/backend/js/ast/JsCatch.java
similarity index 96%
rename from src/com/google/dart/compiler/backend/js/ast/JsCatch.java
rename to js/src/compiler/backend/js/ast/JsCatch.java
index f992545b944..c4693e60f32 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsCatch.java
+++ b/js/src/compiler/backend/js/ast/JsCatch.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Represents a JavaScript catch clause.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsCatchScope.java b/js/src/compiler/backend/js/ast/JsCatchScope.java
similarity index 97%
rename from src/com/google/dart/compiler/backend/js/ast/JsCatchScope.java
rename to js/src/compiler/backend/js/ast/JsCatchScope.java
index 5e5a2f2f577..11b9da8ff56 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsCatchScope.java
+++ b/js/src/compiler/backend/js/ast/JsCatchScope.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
import java.util.Iterator;
import java.util.NoSuchElementException;
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsConditional.java b/js/src/compiler/backend/js/ast/JsConditional.java
similarity index 97%
rename from src/com/google/dart/compiler/backend/js/ast/JsConditional.java
rename to js/src/compiler/backend/js/ast/JsConditional.java
index b1171bac2c0..b62d3174277 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsConditional.java
+++ b/js/src/compiler/backend/js/ast/JsConditional.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Represents a JavaScript conditional expression.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsContext.java b/js/src/compiler/backend/js/ast/JsContext.java
similarity index 92%
rename from src/com/google/dart/compiler/backend/js/ast/JsContext.java
rename to js/src/compiler/backend/js/ast/JsContext.java
index ddb170052d3..1f26369ed16 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsContext.java
+++ b/js/src/compiler/backend/js/ast/JsContext.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* The context in which a JsNode visitation occurs. This represents the set of
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsContinue.java b/js/src/compiler/backend/js/ast/JsContinue.java
similarity index 94%
rename from src/com/google/dart/compiler/backend/js/ast/JsContinue.java
rename to js/src/compiler/backend/js/ast/JsContinue.java
index d761815fe76..8bbfc47f93e 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsContinue.java
+++ b/js/src/compiler/backend/js/ast/JsContinue.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Represents the JavaScript continue statement.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsDebugger.java b/js/src/compiler/backend/js/ast/JsDebugger.java
similarity index 91%
rename from src/com/google/dart/compiler/backend/js/ast/JsDebugger.java
rename to js/src/compiler/backend/js/ast/JsDebugger.java
index 34cfae43f48..7f6a92ab6cc 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsDebugger.java
+++ b/js/src/compiler/backend/js/ast/JsDebugger.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Represents a JavaScript debugger statement.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsDefault.java b/js/src/compiler/backend/js/ast/JsDefault.java
similarity index 92%
rename from src/com/google/dart/compiler/backend/js/ast/JsDefault.java
rename to js/src/compiler/backend/js/ast/JsDefault.java
index a76987a8e5d..16468f4362b 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsDefault.java
+++ b/js/src/compiler/backend/js/ast/JsDefault.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Represents the default option in a JavaScript swtich statement.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsDoWhile.java b/js/src/compiler/backend/js/ast/JsDoWhile.java
similarity index 95%
rename from src/com/google/dart/compiler/backend/js/ast/JsDoWhile.java
rename to js/src/compiler/backend/js/ast/JsDoWhile.java
index 1dd4a47e8d4..f26ce674d4d 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsDoWhile.java
+++ b/js/src/compiler/backend/js/ast/JsDoWhile.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Represents a JavaScript do..while statement.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsEmpty.java b/js/src/compiler/backend/js/ast/JsEmpty.java
similarity index 91%
rename from src/com/google/dart/compiler/backend/js/ast/JsEmpty.java
rename to js/src/compiler/backend/js/ast/JsEmpty.java
index c2ac99e3ac0..d76110ddaa6 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsEmpty.java
+++ b/js/src/compiler/backend/js/ast/JsEmpty.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Represents an empty statement in JavaScript.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsExprStmt.java b/js/src/compiler/backend/js/ast/JsExprStmt.java
similarity index 94%
rename from src/com/google/dart/compiler/backend/js/ast/JsExprStmt.java
rename to js/src/compiler/backend/js/ast/JsExprStmt.java
index 5b9fc1218c3..008a2858843 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsExprStmt.java
+++ b/js/src/compiler/backend/js/ast/JsExprStmt.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Represents a JavaScript expression statement.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsExpression.java b/js/src/compiler/backend/js/ast/JsExpression.java
similarity index 92%
rename from src/com/google/dart/compiler/backend/js/ast/JsExpression.java
rename to js/src/compiler/backend/js/ast/JsExpression.java
index 43545ec98dc..d6eb37da784 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsExpression.java
+++ b/js/src/compiler/backend/js/ast/JsExpression.java
@@ -2,9 +2,9 @@
// 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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
-import com.google.dart.compiler.common.SourceInfo;
+import compiler.common.SourceInfo;
/**
* An abstract base class for all JavaScript expressions.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsFor.java b/js/src/compiler/backend/js/ast/JsFor.java
similarity index 95%
rename from src/com/google/dart/compiler/backend/js/ast/JsFor.java
rename to js/src/compiler/backend/js/ast/JsFor.java
index b980d4be1a2..683941f9f40 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsFor.java
+++ b/js/src/compiler/backend/js/ast/JsFor.java
@@ -2,9 +2,9 @@
// 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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
-import com.google.dart.compiler.common.SourceInfo;
+import compiler.common.SourceInfo;
/**
* A for statement. If specified at all, the initializer part is
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsForIn.java b/js/src/compiler/backend/js/ast/JsForIn.java
similarity index 96%
rename from src/com/google/dart/compiler/backend/js/ast/JsForIn.java
rename to js/src/compiler/backend/js/ast/JsForIn.java
index 646e349885c..3636732cd0f 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsForIn.java
+++ b/js/src/compiler/backend/js/ast/JsForIn.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Represents a JavaScript for..in statement.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsFunction.java b/js/src/compiler/backend/js/ast/JsFunction.java
similarity index 98%
rename from src/com/google/dart/compiler/backend/js/ast/JsFunction.java
rename to js/src/compiler/backend/js/ast/JsFunction.java
index 4563ca58bec..b2ce5c72e2c 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsFunction.java
+++ b/js/src/compiler/backend/js/ast/JsFunction.java
@@ -2,9 +2,9 @@
// 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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
-import com.google.dart.compiler.common.SourceInfo;
+import compiler.common.SourceInfo;
import java.util.ArrayList;
import java.util.List;
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsGlobalBlock.java b/js/src/compiler/backend/js/ast/JsGlobalBlock.java
similarity index 89%
rename from src/com/google/dart/compiler/backend/js/ast/JsGlobalBlock.java
rename to js/src/compiler/backend/js/ast/JsGlobalBlock.java
index 9a14004e14c..39d08fe3991 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsGlobalBlock.java
+++ b/js/src/compiler/backend/js/ast/JsGlobalBlock.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Represnts a JavaScript block in the global scope.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsIf.java b/js/src/compiler/backend/js/ast/JsIf.java
similarity index 96%
rename from src/com/google/dart/compiler/backend/js/ast/JsIf.java
rename to js/src/compiler/backend/js/ast/JsIf.java
index 478538235ab..f5b4bffd995 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsIf.java
+++ b/js/src/compiler/backend/js/ast/JsIf.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Represents a JavaScript if statement.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsInvocation.java b/js/src/compiler/backend/js/ast/JsInvocation.java
similarity index 96%
rename from src/com/google/dart/compiler/backend/js/ast/JsInvocation.java
rename to js/src/compiler/backend/js/ast/JsInvocation.java
index 6704234df29..c2ab1f98d4a 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsInvocation.java
+++ b/js/src/compiler/backend/js/ast/JsInvocation.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
import java.util.ArrayList;
import java.util.List;
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsLabel.java b/js/src/compiler/backend/js/ast/JsLabel.java
similarity index 94%
rename from src/com/google/dart/compiler/backend/js/ast/JsLabel.java
rename to js/src/compiler/backend/js/ast/JsLabel.java
index 7d026c3a6de..5c2e695d33a 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsLabel.java
+++ b/js/src/compiler/backend/js/ast/JsLabel.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Represents a JavaScript label statement.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsLiteral.java b/js/src/compiler/backend/js/ast/JsLiteral.java
similarity index 88%
rename from src/com/google/dart/compiler/backend/js/ast/JsLiteral.java
rename to js/src/compiler/backend/js/ast/JsLiteral.java
index c87ae0c8af1..7157f2f19a8 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsLiteral.java
+++ b/js/src/compiler/backend/js/ast/JsLiteral.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* A JavaScript string literal expression.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsModVisitor.java b/js/src/compiler/backend/js/ast/JsModVisitor.java
similarity index 97%
rename from src/com/google/dart/compiler/backend/js/ast/JsModVisitor.java
rename to js/src/compiler/backend/js/ast/JsModVisitor.java
index ef6e75ce994..bc021da81c4 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsModVisitor.java
+++ b/js/src/compiler/backend/js/ast/JsModVisitor.java
@@ -2,9 +2,9 @@
// 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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
-import com.google.dart.compiler.util.Hack;
+import compiler.util.Hack;
import java.util.List;
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsName.java b/js/src/compiler/backend/js/ast/JsName.java
similarity index 93%
rename from src/com/google/dart/compiler/backend/js/ast/JsName.java
rename to js/src/compiler/backend/js/ast/JsName.java
index 2997bcfb546..e5c57f6f7b4 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsName.java
+++ b/js/src/compiler/backend/js/ast/JsName.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
import java.io.Serializable;
@@ -24,7 +24,7 @@ public class JsName implements Serializable {
/**
* @param ident the unmangled ident to use for this name
*/
- public JsName(JsScope enclosing, String ident, String shortIdent, String originalName) {
+JsName(JsScope enclosing, String ident, String shortIdent, String originalName) {
this.enclosing = enclosing;
this.ident = ident;
this.shortIdent = shortIdent;
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsNameRef.java b/js/src/compiler/backend/js/ast/JsNameRef.java
similarity index 97%
rename from src/com/google/dart/compiler/backend/js/ast/JsNameRef.java
rename to js/src/compiler/backend/js/ast/JsNameRef.java
index dc26c8fa61a..0104808b8a2 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsNameRef.java
+++ b/js/src/compiler/backend/js/ast/JsNameRef.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Represents a JavaScript expression that references a name.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsNew.java b/js/src/compiler/backend/js/ast/JsNew.java
similarity index 96%
rename from src/com/google/dart/compiler/backend/js/ast/JsNew.java
rename to js/src/compiler/backend/js/ast/JsNew.java
index 19b6f5d6c90..b6284fb34e7 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsNew.java
+++ b/js/src/compiler/backend/js/ast/JsNew.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
import java.util.ArrayList;
import java.util.List;
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsNode.java b/js/src/compiler/backend/js/ast/JsNode.java
similarity index 77%
rename from src/com/google/dart/compiler/backend/js/ast/JsNode.java
rename to js/src/compiler/backend/js/ast/JsNode.java
index 0d4b7aaa714..02471539809 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsNode.java
+++ b/js/src/compiler/backend/js/ast/JsNode.java
@@ -1,13 +1,13 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// 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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
-import com.google.dart.compiler.backend.js.JsSourceGenerationVisitor;
-import com.google.dart.compiler.backend.js.JsToStringGenerationVisitor;
-import com.google.dart.compiler.common.AbstractNode;
-import com.google.dart.compiler.common.SourceInfo;
-import com.google.dart.compiler.util.DefaultTextOutput;
+import compiler.backend.js.JsSourceGenerationVisitor;
+import compiler.backend.js.JsToStringGenerationVisitor;
+import compiler.common.AbstractNode;
+import compiler.common.SourceInfo;
+import compiler.util.DefaultTextOutput;
/**
* Base class for all JS AST elements.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsNullLiteral.java b/js/src/compiler/backend/js/ast/JsNullLiteral.java
similarity index 94%
rename from src/com/google/dart/compiler/backend/js/ast/JsNullLiteral.java
rename to js/src/compiler/backend/js/ast/JsNullLiteral.java
index 506b2e3f330..e29251c471c 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsNullLiteral.java
+++ b/js/src/compiler/backend/js/ast/JsNullLiteral.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* A JavaScript null literal.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsNumberLiteral.java b/js/src/compiler/backend/js/ast/JsNumberLiteral.java
similarity index 95%
rename from src/com/google/dart/compiler/backend/js/ast/JsNumberLiteral.java
rename to js/src/compiler/backend/js/ast/JsNumberLiteral.java
index 726c6b0ed27..1fb5c558ae9 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsNumberLiteral.java
+++ b/js/src/compiler/backend/js/ast/JsNumberLiteral.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Represents a JavaScript literal decimal expression.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsObjectLiteral.java b/js/src/compiler/backend/js/ast/JsObjectLiteral.java
similarity index 96%
rename from src/com/google/dart/compiler/backend/js/ast/JsObjectLiteral.java
rename to js/src/compiler/backend/js/ast/JsObjectLiteral.java
index 749ed473c21..7743d2cdb64 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsObjectLiteral.java
+++ b/js/src/compiler/backend/js/ast/JsObjectLiteral.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
import java.util.ArrayList;
import java.util.List;
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsOperator.java b/js/src/compiler/backend/js/ast/JsOperator.java
similarity index 92%
rename from src/com/google/dart/compiler/backend/js/ast/JsOperator.java
rename to js/src/compiler/backend/js/ast/JsOperator.java
index e4440cbe9ab..8db5e1526e9 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsOperator.java
+++ b/js/src/compiler/backend/js/ast/JsOperator.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* A JavaScript operator.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsParameter.java b/js/src/compiler/backend/js/ast/JsParameter.java
similarity index 93%
rename from src/com/google/dart/compiler/backend/js/ast/JsParameter.java
rename to js/src/compiler/backend/js/ast/JsParameter.java
index 17581ce4084..c0e3b5793d1 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsParameter.java
+++ b/js/src/compiler/backend/js/ast/JsParameter.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* A JavaScript parameter.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsPostfixOperation.java b/js/src/compiler/backend/js/ast/JsPostfixOperation.java
similarity index 94%
rename from src/com/google/dart/compiler/backend/js/ast/JsPostfixOperation.java
rename to js/src/compiler/backend/js/ast/JsPostfixOperation.java
index a33536f6c0d..d5548fa94b9 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsPostfixOperation.java
+++ b/js/src/compiler/backend/js/ast/JsPostfixOperation.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* A JavaScript postfix operation.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsPrefixOperation.java b/js/src/compiler/backend/js/ast/JsPrefixOperation.java
similarity index 97%
rename from src/com/google/dart/compiler/backend/js/ast/JsPrefixOperation.java
rename to js/src/compiler/backend/js/ast/JsPrefixOperation.java
index 8ce12c7bacd..25f6a86c2d5 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsPrefixOperation.java
+++ b/js/src/compiler/backend/js/ast/JsPrefixOperation.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* A JavaScript prefix operation.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsProgram.java b/js/src/compiler/backend/js/ast/JsProgram.java
similarity index 96%
rename from src/com/google/dart/compiler/backend/js/ast/JsProgram.java
rename to js/src/compiler/backend/js/ast/JsProgram.java
index 1d2c902d27a..c37ed039990 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsProgram.java
+++ b/js/src/compiler/backend/js/ast/JsProgram.java
@@ -2,7 +2,9 @@
// 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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
+
+import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
import java.util.Map;
@@ -156,7 +158,7 @@ public final class JsProgram extends JsNode {
}
@Override
- public void traverse(JsVisitor v, JsContext ctx) {
+ public void traverse(JsVisitor v, @Nullable JsContext ctx) {
if (v.visit(this, ctx)) {
for (JsProgramFragment fragment : fragments) {
v.accept(fragment);
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsProgramFragment.java b/js/src/compiler/backend/js/ast/JsProgramFragment.java
similarity index 94%
rename from src/com/google/dart/compiler/backend/js/ast/JsProgramFragment.java
rename to js/src/compiler/backend/js/ast/JsProgramFragment.java
index 3c6859e2150..183f1f29d61 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsProgramFragment.java
+++ b/js/src/compiler/backend/js/ast/JsProgramFragment.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* One independently loadable fragment of a {@link JsProgram}.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsPropertyInitializer.java b/js/src/compiler/backend/js/ast/JsPropertyInitializer.java
similarity index 96%
rename from src/com/google/dart/compiler/backend/js/ast/JsPropertyInitializer.java
rename to js/src/compiler/backend/js/ast/JsPropertyInitializer.java
index d68d8d01af4..1431238c4c2 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsPropertyInitializer.java
+++ b/js/src/compiler/backend/js/ast/JsPropertyInitializer.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Used in object literals to specify property values by name.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsRegExp.java b/js/src/compiler/backend/js/ast/JsRegExp.java
similarity index 95%
rename from src/com/google/dart/compiler/backend/js/ast/JsRegExp.java
rename to js/src/compiler/backend/js/ast/JsRegExp.java
index 158c7a5e092..5da7cab3b18 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsRegExp.java
+++ b/js/src/compiler/backend/js/ast/JsRegExp.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* A JavaScript regular expression.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsReturn.java b/js/src/compiler/backend/js/ast/JsReturn.java
similarity index 94%
rename from src/com/google/dart/compiler/backend/js/ast/JsReturn.java
rename to js/src/compiler/backend/js/ast/JsReturn.java
index 16d90e4b353..b3ec46705d9 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsReturn.java
+++ b/js/src/compiler/backend/js/ast/JsReturn.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* A JavaScript return statement.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsRootScope.java b/js/src/compiler/backend/js/ast/JsRootScope.java
similarity index 92%
rename from src/com/google/dart/compiler/backend/js/ast/JsRootScope.java
rename to js/src/compiler/backend/js/ast/JsRootScope.java
index 33b71f26222..b53709a4257 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsRootScope.java
+++ b/js/src/compiler/backend/js/ast/JsRootScope.java
@@ -2,9 +2,9 @@
// 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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
-import com.google.dart.compiler.backend.js.JsReservedIdentifiers;
+import compiler.backend.js.JsReservedIdentifiers;
/**
* The root scope is the parent of every scope. All identifiers in this scope
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsScope.java b/js/src/compiler/backend/js/ast/JsScope.java
similarity index 95%
rename from src/com/google/dart/compiler/backend/js/ast/JsScope.java
rename to js/src/compiler/backend/js/ast/JsScope.java
index e5f0578fb49..04fcbac0117 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsScope.java
+++ b/js/src/compiler/backend/js/ast/JsScope.java
@@ -2,10 +2,10 @@
// 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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
-import com.google.dart.compiler.util.Lists;
-import com.google.dart.compiler.util.Maps;
+import compiler.util.Lists;
+import compiler.util.Maps;
import java.io.Serializable;
import java.util.Collections;
@@ -15,17 +15,17 @@ import java.util.Map;
/**
* A scope is a factory for creating and allocating
- * {@link com.google.dart.compiler.backend.js.ast.JsName}s. A JavaScript AST is
+ * {@link JsName}s. A JavaScript AST is
* built in terms of abstract name objects without worrying about obfuscation,
* keyword/identifier blacklisting, and so on.
*
*
*
* Scopes are associated with
- * {@link com.google.dart.compiler.backend.js.ast.JsFunction}s, but the two are
+ * {@link JsFunction}s, but the two are
* not equivalent. Functions have scopes, but a scope does not
* necessarily have an associated Function. Examples of this include the
- * {@link com.google.dart.compiler.backend.js.ast.JsRootScope} and synthetic
+ * {@link JsRootScope} and synthetic
* scopes that might be created by a client.
*
*
@@ -34,7 +34,7 @@ import java.util.Map;
* identifiers for names. Specifically, names in child scopes are chosen such
* that they do not conflict with names in their parent scopes. The ultimate
* parent is usually the global scope (see
- * {@link com.google.dart.compiler.backend.js.ast.JsProgram#getRootScope()}),
+ * {@link JsProgram#getRootScope()}),
* but parentless scopes are useful for managing names that are always accessed
* with a qualifier and could therefore never be confused with the global scope
* hierarchy.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsStatement.java b/js/src/compiler/backend/js/ast/JsStatement.java
similarity index 91%
rename from src/com/google/dart/compiler/backend/js/ast/JsStatement.java
rename to js/src/compiler/backend/js/ast/JsStatement.java
index 82d37ca1185..9b2c6bba5eb 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsStatement.java
+++ b/js/src/compiler/backend/js/ast/JsStatement.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Abstract base class for JavaScript statement objects.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsStringLiteral.java b/js/src/compiler/backend/js/ast/JsStringLiteral.java
similarity index 95%
rename from src/com/google/dart/compiler/backend/js/ast/JsStringLiteral.java
rename to js/src/compiler/backend/js/ast/JsStringLiteral.java
index 77e60c9b89a..9f0dbbc259f 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsStringLiteral.java
+++ b/js/src/compiler/backend/js/ast/JsStringLiteral.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* A JavaScript string literal expression.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsSwitch.java b/js/src/compiler/backend/js/ast/JsSwitch.java
similarity index 95%
rename from src/com/google/dart/compiler/backend/js/ast/JsSwitch.java
rename to js/src/compiler/backend/js/ast/JsSwitch.java
index 5a49624af42..dc256c394fc 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsSwitch.java
+++ b/js/src/compiler/backend/js/ast/JsSwitch.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
import java.util.ArrayList;
import java.util.List;
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsSwitchMember.java b/js/src/compiler/backend/js/ast/JsSwitchMember.java
similarity index 92%
rename from src/com/google/dart/compiler/backend/js/ast/JsSwitchMember.java
rename to js/src/compiler/backend/js/ast/JsSwitchMember.java
index 0a748f60078..e2025e83a7e 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsSwitchMember.java
+++ b/js/src/compiler/backend/js/ast/JsSwitchMember.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
import java.util.ArrayList;
import java.util.List;
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsThisRef.java b/js/src/compiler/backend/js/ast/JsThisRef.java
similarity index 95%
rename from src/com/google/dart/compiler/backend/js/ast/JsThisRef.java
rename to js/src/compiler/backend/js/ast/JsThisRef.java
index 9adb6459488..3c38a5287c3 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsThisRef.java
+++ b/js/src/compiler/backend/js/ast/JsThisRef.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* A JavaScript this reference.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsThrow.java b/js/src/compiler/backend/js/ast/JsThrow.java
similarity index 94%
rename from src/com/google/dart/compiler/backend/js/ast/JsThrow.java
rename to js/src/compiler/backend/js/ast/JsThrow.java
index 4616418fb6b..de5125c4847 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsThrow.java
+++ b/js/src/compiler/backend/js/ast/JsThrow.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* A JavaScript throw statement.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsTry.java b/js/src/compiler/backend/js/ast/JsTry.java
similarity index 96%
rename from src/com/google/dart/compiler/backend/js/ast/JsTry.java
rename to js/src/compiler/backend/js/ast/JsTry.java
index 61357bcd406..ad7348e018b 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsTry.java
+++ b/js/src/compiler/backend/js/ast/JsTry.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
import java.util.ArrayList;
import java.util.List;
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsUnaryOperation.java b/js/src/compiler/backend/js/ast/JsUnaryOperation.java
similarity index 96%
rename from src/com/google/dart/compiler/backend/js/ast/JsUnaryOperation.java
rename to js/src/compiler/backend/js/ast/JsUnaryOperation.java
index 00f103f35c9..ce296e8f601 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsUnaryOperation.java
+++ b/js/src/compiler/backend/js/ast/JsUnaryOperation.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* A JavaScript prefix or postfix operation.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsUnaryOperator.java b/js/src/compiler/backend/js/ast/JsUnaryOperator.java
similarity index 97%
rename from src/com/google/dart/compiler/backend/js/ast/JsUnaryOperator.java
rename to js/src/compiler/backend/js/ast/JsUnaryOperator.java
index 2b854d8313e..83e5ccc9285 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsUnaryOperator.java
+++ b/js/src/compiler/backend/js/ast/JsUnaryOperator.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* A JavaScript unary operator.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsValueLiteral.java b/js/src/compiler/backend/js/ast/JsValueLiteral.java
similarity index 91%
rename from src/com/google/dart/compiler/backend/js/ast/JsValueLiteral.java
rename to js/src/compiler/backend/js/ast/JsValueLiteral.java
index f23ab5dbce4..06e80bed6a4 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsValueLiteral.java
+++ b/js/src/compiler/backend/js/ast/JsValueLiteral.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* A JavaScript string literal expression.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsVars.java b/js/src/compiler/backend/js/ast/JsVars.java
similarity index 95%
rename from src/com/google/dart/compiler/backend/js/ast/JsVars.java
rename to js/src/compiler/backend/js/ast/JsVars.java
index aaf629259aa..2fbf0cbff75 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsVars.java
+++ b/js/src/compiler/backend/js/ast/JsVars.java
@@ -2,9 +2,9 @@
// 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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
-import com.google.dart.compiler.common.SourceInfo;
+import compiler.common.SourceInfo;
import java.util.ArrayList;
import java.util.Iterator;
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsVisitable.java b/js/src/compiler/backend/js/ast/JsVisitable.java
similarity index 92%
rename from src/com/google/dart/compiler/backend/js/ast/JsVisitable.java
rename to js/src/compiler/backend/js/ast/JsVisitable.java
index 626648af8ae..5d436e053dc 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsVisitable.java
+++ b/js/src/compiler/backend/js/ast/JsVisitable.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* Abstracts the idea that a class can be traversed.
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsVisitor.java b/js/src/compiler/backend/js/ast/JsVisitor.java
similarity index 97%
rename from src/com/google/dart/compiler/backend/js/ast/JsVisitor.java
rename to js/src/compiler/backend/js/ast/JsVisitor.java
index a3417a02817..da05408b6e3 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsVisitor.java
+++ b/js/src/compiler/backend/js/ast/JsVisitor.java
@@ -2,9 +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.
-package com.google.dart.compiler.backend.js.ast;
-
-import com.google.dart.compiler.backend.js.ast.JsVars.JsVar;
+package compiler.backend.js.ast;
import java.util.List;
@@ -227,7 +225,7 @@ public class JsVisitor {
public void endVisit(JsTry x, JsContext ctx) {
}
- public void endVisit(JsVar x, JsContext ctx) {
+ public void endVisit(JsVars.JsVar x, JsContext ctx) {
}
public void endVisit(JsVars x, JsContext ctx) {
@@ -392,7 +390,7 @@ public class JsVisitor {
return true;
}
- public boolean visit(JsVar x, JsContext ctx) {
+ public boolean visit(JsVars.JsVar x, JsContext ctx) {
return true;
}
diff --git a/src/com/google/dart/compiler/backend/js/ast/JsWhile.java b/js/src/compiler/backend/js/ast/JsWhile.java
similarity index 95%
rename from src/com/google/dart/compiler/backend/js/ast/JsWhile.java
rename to js/src/compiler/backend/js/ast/JsWhile.java
index c40203bc1f1..0a4e8d64c21 100644
--- a/src/com/google/dart/compiler/backend/js/ast/JsWhile.java
+++ b/js/src/compiler/backend/js/ast/JsWhile.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
/**
* A JavaScript while statement.
diff --git a/src/com/google/dart/compiler/backend/js/ast/NodeKind.java b/js/src/compiler/backend/js/ast/NodeKind.java
similarity index 93%
rename from src/com/google/dart/compiler/backend/js/ast/NodeKind.java
rename to js/src/compiler/backend/js/ast/NodeKind.java
index 614e4bb3bd9..60b38e43d34 100644
--- a/src/com/google/dart/compiler/backend/js/ast/NodeKind.java
+++ b/js/src/compiler/backend/js/ast/NodeKind.java
@@ -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.
-package com.google.dart.compiler.backend.js.ast;
+package compiler.backend.js.ast;
public enum NodeKind {
ARRAY_ACCESS,
diff --git a/src/com/google/dart/compiler/common/AbstractNode.java b/js/src/compiler/common/AbstractNode.java
similarity index 96%
rename from src/com/google/dart/compiler/common/AbstractNode.java
rename to js/src/compiler/common/AbstractNode.java
index 5b70197dd13..de8522e3084 100644
--- a/src/com/google/dart/compiler/common/AbstractNode.java
+++ b/js/src/compiler/common/AbstractNode.java
@@ -2,9 +2,9 @@
// 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.
-package com.google.dart.compiler.common;
+package compiler.common;
-import com.google.dart.compiler.Source;
+import compiler.Source;
/**
* Abstract base class for nodes that carry source information.
diff --git a/src/com/google/dart/compiler/common/HasSourceInfo.java b/js/src/compiler/common/HasSourceInfo.java
similarity index 96%
rename from src/com/google/dart/compiler/common/HasSourceInfo.java
rename to js/src/compiler/common/HasSourceInfo.java
index bda3da94996..ba81f974ca4 100644
--- a/src/com/google/dart/compiler/common/HasSourceInfo.java
+++ b/js/src/compiler/common/HasSourceInfo.java
@@ -2,9 +2,9 @@
// 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.
-package com.google.dart.compiler.common;
+package compiler.common;
-import com.google.dart.compiler.Source;
+import compiler.Source;
/**
* Abstract view of a class that has source info.
diff --git a/src/com/google/dart/compiler/common/Name.java b/js/src/compiler/common/Name.java
similarity index 98%
rename from src/com/google/dart/compiler/common/Name.java
rename to js/src/compiler/common/Name.java
index 4697b491d96..7bff8269725 100644
--- a/src/com/google/dart/compiler/common/Name.java
+++ b/js/src/compiler/common/Name.java
@@ -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.
-package com.google.dart.compiler.common;
+package compiler.common;
import java.io.*;
import java.nio.charset.Charset;
diff --git a/src/com/google/dart/compiler/common/NameFactory.java b/js/src/compiler/common/NameFactory.java
similarity index 99%
rename from src/com/google/dart/compiler/common/NameFactory.java
rename to js/src/compiler/common/NameFactory.java
index d305f290bf9..8139b2e984c 100644
--- a/src/com/google/dart/compiler/common/NameFactory.java
+++ b/js/src/compiler/common/NameFactory.java
@@ -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.
-package com.google.dart.compiler.common;
+package compiler.common;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.MapMaker;
diff --git a/src/com/google/dart/compiler/common/SourceInfo.java b/js/src/compiler/common/SourceInfo.java
similarity index 95%
rename from src/com/google/dart/compiler/common/SourceInfo.java
rename to js/src/compiler/common/SourceInfo.java
index bb212e9c1bd..becdfa5b025 100644
--- a/src/com/google/dart/compiler/common/SourceInfo.java
+++ b/js/src/compiler/common/SourceInfo.java
@@ -2,8 +2,8 @@
// 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.
-package com.google.dart.compiler.common;
-import com.google.dart.compiler.Source;
+package compiler.common;
+import compiler.Source;
import java.io.Serializable;
diff --git a/src/com/google/dart/compiler/util/AbstractTextOutput.java b/js/src/compiler/util/AbstractTextOutput.java
similarity index 98%
rename from src/com/google/dart/compiler/util/AbstractTextOutput.java
rename to js/src/compiler/util/AbstractTextOutput.java
index 9c8d2b1cd16..ab8fdc8634f 100644
--- a/src/com/google/dart/compiler/util/AbstractTextOutput.java
+++ b/js/src/compiler/util/AbstractTextOutput.java
@@ -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.
-package com.google.dart.compiler.util;
+package compiler.util;
import java.io.PrintWriter;
import java.util.Arrays;
diff --git a/src/com/google/dart/compiler/util/AstUtil.java b/js/src/compiler/util/AstUtil.java
similarity index 94%
rename from src/com/google/dart/compiler/util/AstUtil.java
rename to js/src/compiler/util/AstUtil.java
index 826426b5557..f5aa7e7bc21 100644
--- a/src/com/google/dart/compiler/util/AstUtil.java
+++ b/js/src/compiler/util/AstUtil.java
@@ -2,12 +2,12 @@
// 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.
-package com.google.dart.compiler.util;
+package compiler.util;
-import com.google.dart.compiler.InternalCompilerException;
-import com.google.dart.compiler.backend.js.ast.*;
-import com.google.dart.compiler.backend.js.ast.JsVars.JsVar;
-import com.google.dart.compiler.common.SourceInfo;
+import compiler.InternalCompilerException;
+import compiler.common.SourceInfo;
+import compiler.backend.js.ast.*;
+import org.jetbrains.annotations.Nullable;
import java.util.List;
@@ -125,7 +125,7 @@ public class AstUtil {
}
public static JsVars newVar(SourceInfo info, JsName name, JsExpression expr) {
- JsVar var = new JsVar(name).setSourceRef(info);
+ JsVars.JsVar var = new JsVars.JsVar(name).setSourceRef(info);
var.setInitExpr(expr);
JsVars vars = new JsVars();
vars.add(var);
@@ -133,7 +133,7 @@ public class AstUtil {
}
public static JsVars newVar(JsName name, JsExpression expr) {
- JsVar var = new JsVar(name);
+ JsVars.JsVar var = new JsVars.JsVar(name);
if (expr != null) {
var.setInitExpr(expr);
}
@@ -170,7 +170,7 @@ public class AstUtil {
}
public static JsFunction newFunction(
- JsScope scope, JsName name, List params, JsBlock body) {
+ JsScope scope, @Nullable JsName name, List params, JsBlock body) {
JsFunction fn = new JsFunction(scope);
if (name != null) {
fn.setName(name);
@@ -223,7 +223,7 @@ public class AstUtil {
}
public static JsNameRef nameref(SourceInfo src, JsName qualifier, String prop) {
- return AstUtil.nameref(src, qualifier.makeRef().setSourceRef(src), prop);
+ return nameref(src, qualifier.makeRef().setSourceRef(src), prop);
}
public static JsNameRef nameref(SourceInfo src, JsExpression qualifier, String prop) {
diff --git a/src/com/google/dart/compiler/util/DefaultTextOutput.java b/js/src/compiler/util/DefaultTextOutput.java
similarity index 95%
rename from src/com/google/dart/compiler/util/DefaultTextOutput.java
rename to js/src/compiler/util/DefaultTextOutput.java
index 2a064ff87fd..fe66e8d2ab4 100644
--- a/src/com/google/dart/compiler/util/DefaultTextOutput.java
+++ b/js/src/compiler/util/DefaultTextOutput.java
@@ -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.
-package com.google.dart.compiler.util;
+package compiler.util;
import java.io.PrintWriter;
import java.io.StringWriter;
diff --git a/src/com/google/dart/compiler/util/Hack.java b/js/src/compiler/util/Hack.java
similarity index 91%
rename from src/com/google/dart/compiler/util/Hack.java
rename to js/src/compiler/util/Hack.java
index 642f416394f..02526b87db7 100644
--- a/src/com/google/dart/compiler/util/Hack.java
+++ b/js/src/compiler/util/Hack.java
@@ -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.
-package com.google.dart.compiler.util;
+package compiler.util;
/**
* Utility to hack around untypable (or yet to be) code.
diff --git a/src/com/google/dart/compiler/util/Lists.java b/js/src/compiler/util/Lists.java
similarity index 99%
rename from src/com/google/dart/compiler/util/Lists.java
rename to js/src/compiler/util/Lists.java
index b0ca023d280..5eca177a5e5 100644
--- a/src/com/google/dart/compiler/util/Lists.java
+++ b/js/src/compiler/util/Lists.java
@@ -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.
-package com.google.dart.compiler.util;
+package compiler.util;
import java.util.*;
diff --git a/src/com/google/dart/compiler/util/Maps.java b/js/src/compiler/util/Maps.java
similarity index 99%
rename from src/com/google/dart/compiler/util/Maps.java
rename to js/src/compiler/util/Maps.java
index 15274b04902..f70c9b4c144 100644
--- a/src/com/google/dart/compiler/util/Maps.java
+++ b/js/src/compiler/util/Maps.java
@@ -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.
-package com.google.dart.compiler.util;
+package compiler.util;
import java.util.Collections;
import java.util.HashMap;
diff --git a/src/com/google/dart/compiler/util/Paths.java b/js/src/compiler/util/Paths.java
similarity index 98%
rename from src/com/google/dart/compiler/util/Paths.java
rename to js/src/compiler/util/Paths.java
index cdda910ccb1..35f63b6667d 100644
--- a/src/com/google/dart/compiler/util/Paths.java
+++ b/js/src/compiler/util/Paths.java
@@ -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.
-package com.google.dart.compiler.util;
+package compiler.util;
import java.io.File;
import java.net.URI;
diff --git a/src/com/google/dart/compiler/util/TextOutput.java b/js/src/compiler/util/TextOutput.java
similarity index 93%
rename from src/com/google/dart/compiler/util/TextOutput.java
rename to js/src/compiler/util/TextOutput.java
index 99a465b1532..d5c7f08a8c7 100644
--- a/src/com/google/dart/compiler/util/TextOutput.java
+++ b/js/src/compiler/util/TextOutput.java
@@ -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.
-package com.google.dart.compiler.util;
+package compiler.util;
/**
* Interface used for printing text output.
diff --git a/out/production/k2js/org/jetbrains/k2js/translate/ContextType$1.class b/out/production/k2js/org/jetbrains/k2js/translate/ContextType$1.class
deleted file mode 100644
index f5d89742260..00000000000
Binary files a/out/production/k2js/org/jetbrains/k2js/translate/ContextType$1.class and /dev/null differ
diff --git a/out/production/k2js/org/jetbrains/k2js/translate/ContextType$2.class b/out/production/k2js/org/jetbrains/k2js/translate/ContextType$2.class
deleted file mode 100644
index 26d4a350b88..00000000000
Binary files a/out/production/k2js/org/jetbrains/k2js/translate/ContextType$2.class and /dev/null differ
diff --git a/out/production/k2js/org/jetbrains/k2js/translate/ContextType$3.class b/out/production/k2js/org/jetbrains/k2js/translate/ContextType$3.class
deleted file mode 100644
index 14b7059c19e..00000000000
Binary files a/out/production/k2js/org/jetbrains/k2js/translate/ContextType$3.class and /dev/null differ
diff --git a/out/production/k2js/org/jetbrains/k2js/translate/ContextType.class b/out/production/k2js/org/jetbrains/k2js/translate/ContextType.class
deleted file mode 100644
index c6ee6638d33..00000000000
Binary files a/out/production/k2js/org/jetbrains/k2js/translate/ContextType.class and /dev/null differ
diff --git a/out/production/k2js/org/jetbrains/k2js/translate/DeclarationTranslator$FunctionVariableDeclaration.class b/out/production/k2js/org/jetbrains/k2js/translate/DeclarationTranslator$FunctionVariableDeclaration.class
deleted file mode 100644
index a981cf1ce32..00000000000
Binary files a/out/production/k2js/org/jetbrains/k2js/translate/DeclarationTranslator$FunctionVariableDeclaration.class and /dev/null differ
diff --git a/out/production/k2js/org/jetbrains/k2js/translate/DeclarationTranslator$NamespacePropertyDeclaration.class b/out/production/k2js/org/jetbrains/k2js/translate/DeclarationTranslator$NamespacePropertyDeclaration.class
deleted file mode 100644
index c01e6d1e8b3..00000000000
Binary files a/out/production/k2js/org/jetbrains/k2js/translate/DeclarationTranslator$NamespacePropertyDeclaration.class and /dev/null differ
diff --git a/out/production/k2js/org/jetbrains/k2js/translate/DeclarationTranslator$State.class b/out/production/k2js/org/jetbrains/k2js/translate/DeclarationTranslator$State.class
deleted file mode 100644
index 836a1ca7a38..00000000000
Binary files a/out/production/k2js/org/jetbrains/k2js/translate/DeclarationTranslator$State.class and /dev/null differ
diff --git a/src/com/google/dart/compiler/backend/js/JsNameProvider.java b/src/com/google/dart/compiler/backend/js/JsNameProvider.java
deleted file mode 100644
index 5cdab3dc714..00000000000
--- a/src/com/google/dart/compiler/backend/js/JsNameProvider.java
+++ /dev/null
@@ -1,85 +0,0 @@
-//// Copyright 2011, the Dart project authors. All rights reserved.
-//// Redistribution and use in source and binary forms, with or without
-//// modification, are permitted provided that the following conditions are
-//// met:
-////
-//// * Redistributions of source code must retain the above copyright
-//// notice, this list of conditions and the following disclaimer.
-//// * Redistributions in binary form must reproduce the above
-//// copyright notice, this list of conditions and the following
-//// disclaimer in the documentation and/or other materials provided
-//// with the distribution.
-//// * Neither the name of Google Inc. nor the names of its
-//// contributors may be used to endorse or promote products derived
-//// from this software without specific prior written permission.
-////
-//// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-//// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-//// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-//// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-//// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-//// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-//// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-//// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//package com.google.dart.compiler.backend.js;
-//
-//import com.google.dart.compiler.backend.js.ast.JsName;
-//import com.google.dart.compiler.backend.js.ast.JsProgram;
-//import com.google.dart.compiler.backend.js.ast.JsScope;
-//import com.google.dart.compiler.resolver.ClassElement;
-//import com.google.dart.compiler.resolver.ElementKind;
-//
-//import java.util.HashMap;
-//import java.util.Map;
-//
-///**
-// * A helper class for managing global names.
-// * @author johnlenz@google.com (John Lenz)
-// */
-//class JsNameProvider {
-// private final DartMangler mangler;
-// private Map names = new HashMap();
-// private JsScope globalScope;
-//
-// JsNameProvider(JsProgram program, DartMangler mangler) {
-// this.globalScope = program.getScope();
-// this.mangler = mangler;
-// }
-//
-// /**
-// * Returns the JsName for the given element. If the element is global and
-// * hasn't been declared yet, it is done now.
-// */
-// JsName getName(Symbol symbol) {
-// JsName jsName = names.get(symbol);
-// if (jsName != null) {
-// assert !jsName.getShortIdent().equals("Object$Dart");
-// return jsName;
-// }
-// assert ElementKind.of(symbol).equals(ElementKind.CLASS)
-// : "Only classes can be lazily declared. Undeclared: "
-// + symbol.getOriginalSymbolName();
-// ClassElement classElement = (ClassElement) symbol;
-// String name = classElement.getName();
-// String nativeName = classElement.getNativeName();
-// if (nativeName == null) {
-// String mangledClassName = mangler.mangleClassName(classElement);
-// jsName = globalScope.declareName(mangledClassName, mangledClassName, name);
-// } else {
-// jsName = globalScope.declareName(nativeName);
-// }
-// // Class names are globally accessible.
-// jsName.setObfuscatable(false);
-// names.put(symbol, jsName);
-// assert !jsName.getShortIdent().equals("Object$Dart") : "unexpected " + ((ClassElement) symbol).getNode().getSource().getName();
-// return jsName;
-// }
-//
-// void setName(Symbol symbol, JsName name) {
-// names.put(symbol, name);
-// }
-//}
diff --git a/src/org/jetbrains/k2js/translate/ClassBodyVisitor.java b/src/org/jetbrains/k2js/translate/ClassBodyVisitor.java
deleted file mode 100644
index 5572f24304e..00000000000
--- a/src/org/jetbrains/k2js/translate/ClassBodyVisitor.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package org.jetbrains.k2js.translate;
-
-import com.google.dart.compiler.backend.js.ast.*;
-import com.google.dart.compiler.util.AstUtil;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.jet.lang.psi.JetClass;
-import org.jetbrains.jet.lang.psi.JetDeclaration;
-import org.jetbrains.jet.lang.psi.JetProperty;
-import org.jetbrains.jet.lang.psi.JetPropertyAccessor;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author Talanov Pavel
- */
-public class ClassBodyVisitor extends K2JsVisitor> {
-
- @Override
- @NotNull
- public List visitClass(JetClass expression, TranslationContext context) {
- List properties = new ArrayList();
- for (JetDeclaration declaration : expression.getDeclarations()) {
- properties.addAll(declaration.accept(this, context));
- }
- return properties;
- }
-
- @Override
- @NotNull
- public List visitProperty(JetProperty expression, TranslationContext context) {
- List methods = new ArrayList();
- if (expression.getSetter() != null) {
- methods.addAll(expression.getSetter().accept(this, context));
- } else {
- if (expression.isVar()) {
- methods.add(generateDefaultSetter(expression, context));
- }
- }
- if (expression.getGetter() != null) {
- methods.addAll(expression.getGetter().accept(this, context));
- } else {
- methods.add(generateDefaultGetter(expression, context));
- }
- return methods;
- }
-
- @NotNull
- private JsPropertyInitializer generateDefaultGetter(JetProperty expression, TranslationContext context) {
- return AstUtil.newNamedMethod
- (Namer.getNameForGetter(expression.getName()), generateDefaultGetterFunction(expression, context));
- }
-
- @NotNull
- private JsFunction generateDefaultGetterFunction(JetProperty expression, TranslationContext context) {
- JsNameRef backingFieldRef = Namer.getBackingFieldNameForProperty(expression.getName()).makeRef();
- JsReturn returnExpression = new JsReturn(backingFieldRef);
- return AstUtil.newFunction
- (context.enclosingScope(), null, Collections.EMPTY_LIST, AstUtil.convertToBlock(returnExpression));
- }
-
-
- @NotNull
- private JsPropertyInitializer generateDefaultSetter(JetProperty expression, TranslationContext context) {
- return AstUtil.newNamedMethod(
- Namer.getNameForAccessor(expression.getName(), null), generateDefaultSetterFunction(expression, context));
- }
-
- @NotNull
- private JsFunction generateDefaultSetterFunction(JetProperty expression, TranslationContext context) {
- JsFunction result = new JsFunction(context.enclosingScope());
- JsParameter defaultParameter = new JsParameter(context.enclosingScope().declareFreshName(Namer.DEFAULT_SETTER_PARAM_NAME));
- JsBinaryOperation assignExpression = new JsBinaryOperation(JsBinaryOperator.ASG);
- assignExpression.setArg1(Namer.getBackingFieldNameForProperty(expression).makeRef());
- assignExpression.setArg2(defaultParameter.getName().makeRef());
- return result;
- }
-
- @Override
- @NotNull
- public List visitPropertyAccessor
- (JetPropertyAccessor expression, TranslationContext context) {
- List methods = new ArrayList();
- JsPropertyInitializer namedMethod = generateMethodForAccessor(expression, context);
- methods.add(namedMethod);
- return methods;
- }
-
- private JsPropertyInitializer generateMethodForAccessor(JetPropertyAccessor expression, TranslationContext context) {
- JsFunction methodBody = new JsFunction(context.enclosingScope());
- ExpressionTranslator expressionTranslator =
- new ExpressionTranslator(context.newFunction(methodBody));
- JsBlock methodBodyBlock = AstUtil.convertToBlock(expressionTranslator.translate(expression.getBodyExpression()));
- methodBody.setBody(methodBodyBlock);
- //TODO figure out naming pattern
- return AstUtil.newNamedMethod(Namer.getNameForAccessor("nameForAccessor", expression), methodBody);
- }
-
-
-}
diff --git a/src/org/jetbrains/k2js/translate/ContextType.java b/src/org/jetbrains/k2js/translate/ContextType.java
deleted file mode 100644
index 50afc79f6a6..00000000000
--- a/src/org/jetbrains/k2js/translate/ContextType.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.jetbrains.k2js.translate;
-
-/**
- * @author Talanov Pavel
- */
-public enum ContextType {
- CLASS_DECLARATION {
- public DeclarationTranslator.State getDeclarationTranslatorState(DeclarationTranslator translator) {
- throw new UnsupportedOperationException("Not impelemented");
- }
- },
- FUNCTION_BODY {
- public DeclarationTranslator.State getDeclarationTranslatorState(DeclarationTranslator translator) {
- return translator.new FunctionVariableDeclaration();
- };
- },
- NAMESPACE_BODY {
- public DeclarationTranslator.State getDeclarationTranslatorState(DeclarationTranslator translator) {
- return translator.new NamespacePropertyDeclaration();
- };
- };
-
- public abstract DeclarationTranslator.State getDeclarationTranslatorState(DeclarationTranslator translator);
-}
diff --git a/src/org/jetbrains/k2js/translate/DeclarationTranslator.java b/src/org/jetbrains/k2js/translate/DeclarationTranslator.java
deleted file mode 100644
index 3bb19ebdeeb..00000000000
--- a/src/org/jetbrains/k2js/translate/DeclarationTranslator.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.jetbrains.k2js.translate;
-
-import com.google.dart.compiler.backend.js.ast.JsExpression;
-import com.google.dart.compiler.backend.js.ast.JsName;
-import com.google.dart.compiler.backend.js.ast.JsNameRef;
-import com.google.dart.compiler.backend.js.ast.JsStatement;
-import com.google.dart.compiler.util.AstUtil;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.jet.lang.psi.*;
-
-/**
- * @author Talanov Pavel
- */
-public class DeclarationTranslator extends AbstractTranslator {
-
- private final State state;
-
- public DeclarationTranslator(TranslationContext context) {
- super(context);
- state = context.type().getDeclarationTranslatorState(this);
- }
-
- @NotNull
- JsStatement translateDeclaration(JetDeclaration declaration) {
- if (declaration instanceof JetProperty) {
- return (translateProperty((JetProperty) declaration));
- }
- if (declaration instanceof JetNamedFunction) {
- return AstUtil.convertToStatement((new FunctionTranslator(translationContext()))
- .translateFunction((JetNamedFunction) declaration));
- }
- else if (declaration instanceof JetClass) {
- ClassTranslator classTranslator = new ClassTranslator(translationContext());
- return classTranslator.translateClass((JetClass)declaration);
- }
- else if (declaration instanceof JetNamespace) {
- // JetNamespace childNamespace = (JetNamespace) declaration;
- // state.forNamespace(childNamespace).translate(childNamespace);
- }
- throw new RuntimeException("Unexpected declaration " + declaration.toString());
- }
-
- @NotNull
- public JsStatement translateProperty(JetProperty declaration) {
- return state.translateProperty(declaration);
- }
-
- @Nullable
- private JsExpression translateInitializer(JetProperty declaration) {
- JsExpression jsInitExpression = null;
- JetExpression initializer = declaration.getInitializer();
- if (initializer != null) {
- // TODO hack alert
- jsInitExpression = (JsExpression)
- (new ExpressionTranslator(translationContext())).translate(initializer);
- }
- return jsInitExpression;
- }
-
- public abstract class State {
- public abstract JsStatement translateProperty(JetProperty declaration);
- }
-
- public final class FunctionVariableDeclaration extends State {
- @NotNull
- public JsStatement translateProperty(JetProperty declaration) {
- JsName jsPropertyName = translationContext().declareLocalName(declaration.getName());
- JsExpression jsInitExpression = translateInitializer(declaration);
- return AstUtil.newVar(jsPropertyName, jsInitExpression);
- }
-
- }
-
- public final class NamespacePropertyDeclaration extends State {
- @NotNull
- public JsStatement translateProperty(JetProperty declaration) {
- JsName propertyName = translationContext().declareLocalName(declaration.getName());
- JsNameRef jsPropertyNameReference =
- translationContext().getNamespaceQualifiedReference(propertyName);
- JsExpression jsInitExpression = translateInitializer(declaration);
- JsExpression result;
- if (jsInitExpression != null) {
- result = AstUtil.newAssignment(jsPropertyNameReference, jsInitExpression);
- }
- else {
- result = jsPropertyNameReference;
- }
- return AstUtil.convertToStatement(result);
- }
- }
-
-
-
-}
diff --git a/src/org/jetbrains/k2js/translate/ExpressionVisitor.java b/src/org/jetbrains/k2js/translate/ExpressionVisitor.java
deleted file mode 100644
index a1a89bd3fbd..00000000000
--- a/src/org/jetbrains/k2js/translate/ExpressionVisitor.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package org.jetbrains.k2js.translate;
-
-import com.google.dart.compiler.backend.js.ast.*;
-import com.google.dart.compiler.util.AstUtil;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.jet.lang.psi.*;
-import org.jetbrains.jet.lang.resolve.BindingContext;
-import org.jetbrains.jet.lang.resolve.calls.ExpressionValueArgument;
-import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
-import org.jetbrains.jet.lexer.JetToken;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Talanov Pavel
- */
-public class ExpressionVisitor extends K2JsVisitor {
-
- @Override
- @NotNull
- public JsNode visitConstantExpression(JetConstantExpression expression, TranslationContext context) {
- JsExpression result = null;
- Object value;
- CompileTimeConstant> compileTimeValue = context.bindingContext().get(BindingContext.COMPILE_TIME_VALUE, expression);
- assert compileTimeValue != null;
- value = compileTimeValue.getValue();
- if (value instanceof Integer) {
- result = context.program().getNumberLiteral((Integer) value);
- }
- if (value instanceof Boolean) {
- return context.program().getBooleanLiteral((Boolean) value);
- }
- assert result != null;
- return result;
- }
-
- @Override
- @NotNull
- public JsNode visitBlockExpression(JetBlockExpression jetBlock, TranslationContext context) {
- List jetElements = jetBlock.getStatements();
- JsBlock jsBlock = new JsBlock();
- TranslationContext newContext = context.newBlock();
- for (JetElement jetElement : jetElements) {
- //TODO hack alert
- JetExpression jetExpression = (JetExpression) jetElement;
- JsNode jsNode = jetExpression.accept(this, newContext);
- jsBlock.addStatement(AstUtil.convertToStatement(jsNode));
- }
- assert jsBlock != null;
- return jsBlock;
- }
-
- @Override
- @NotNull
- public JsNode visitReturnExpression(JetReturnExpression jetReturnExpression, TranslationContext context) {
- //TODO hack alert
- if (jetReturnExpression.getReturnedExpression() != null) {
- JsExpression jsExpression = (JsExpression) (jetReturnExpression.getReturnedExpression().accept(this, context));
- JsReturn jsReturnExpression = new JsReturn(jsExpression);
- return jsReturnExpression;
- }
- return new JsReturn();
- }
-
- @Override
- @NotNull
- public JsNode visitParenthesizedExpression(JetParenthesizedExpression expression, TranslationContext context) {
- return (expression.getExpression()).accept(this, context);
- }
-
- @Override
- @NotNull
- public JsNode visitBinaryExpression(JetBinaryExpression expression, TranslationContext context) {
- JsExpression left = AstUtil.convertToExpression(expression.getLeft().accept(this, context));
- JsExpression right = AstUtil.convertToExpression(expression.getRight().accept(this, context));
- //TODO cast dangerous?
- JetToken jetOperationToken = (JetToken)expression.getOperationToken();
- JsBinaryOperation jsBinaryOperation =
- new JsBinaryOperation(OperationTranslator.getBinaryOperator(jetOperationToken), left, right);
- return jsBinaryOperation;
- }
-
- //TODO think about recursive/non-recursive name look-up
- @Override
- @NotNull
- public JsNode visitSimpleNameExpression(JetSimpleNameExpression expression, TranslationContext context) {
- String referencedName = expression.getReferencedName();
- JsName jsName = context.enclosingScope().findExistingNameNoRecurse(referencedName);
- if (jsName != null) {
- return jsName.makeRef();
- }
- jsName = context.functionScope().findExistingNameNoRecurse(referencedName);
- if (jsName != null) {
- return context.getNamespaceQualifiedReference(jsName);
- }
- jsName = context.namespaceScope().findExistingNameNoRecurse(referencedName);
- if (jsName != null) {
- return context.getNamespaceQualifiedReference(jsName);
- }
- throw new AssertionError("Unindentified name " + expression.getReferencedName());
- }
-
- @Override
- @NotNull
- public JsNode visitProperty(JetProperty expression, TranslationContext context) {
- DeclarationTranslator translator = new DeclarationTranslator(context);
- return translator.translateProperty(expression);
- }
-
- @Override
- @NotNull
- public JsNode visitCallExpression(JetCallExpression expression, TranslationContext context) {
- JsExpression callee = getCallee(expression, context);
- List arguments = generateArgumentList(expression.getValueArguments(), context);
- return AstUtil.newInvocation(callee, arguments);
- }
-
- @NotNull
- private JsExpression getCallee(JetCallExpression expression, TranslationContext context) {
- JsNode jsCallee = expression.getCalleeExpression().accept(this, context);
- return AstUtil.convertToExpression(jsCallee);
- }
-
- @NotNull
- private List generateArgumentList(List extends ValueArgument> jetArguments, TranslationContext context) {
- List jsArguments = new ArrayList();
- for (ValueArgument argument : jetArguments) {
- JetExpression jetExpression = argument.getArgumentExpression();
- jsArguments.add(AstUtil.convertToExpression(jetExpression.accept(this, context)));
- }
- return jsArguments;
- }
-
-}
diff --git a/src/org/jetbrains/k2js/translate/K2JsVisitor.java b/src/org/jetbrains/k2js/translate/K2JsVisitor.java
deleted file mode 100644
index ce248446966..00000000000
--- a/src/org/jetbrains/k2js/translate/K2JsVisitor.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.jetbrains.k2js.translate;
-
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.jet.lang.psi.JetElement;
-import org.jetbrains.jet.lang.psi.JetVisitor;
-
-/**
- * @author Talanov Pavel
- */
-public class K2JsVisitor extends JetVisitor {
-
- @Override
- @NotNull
- public T visitJetElement(JetElement expression, TranslationContext context) {
- throw new RuntimeException("Unexpected expression encountered:" + expression.toString());
- }
-}
diff --git a/test/org/jetbrains/k2js/test/ClassTest.java b/test/org/jetbrains/k2js/test/ClassTest.java
new file mode 100644
index 00000000000..a5858f42e8a
--- /dev/null
+++ b/test/org/jetbrains/k2js/test/ClassTest.java
@@ -0,0 +1,50 @@
+package org.jetbrains.k2js.test;
+
+import org.jetbrains.k2js.translate.TranslationContext;
+import org.junit.Test;
+import org.mozilla.javascript.Context;
+import org.mozilla.javascript.Scriptable;
+
+import java.io.FileReader;
+
+import static org.junit.Assert.assertTrue;
+
+/**
+ * @author Talanov Pavel
+ */
+public final class ClassTest extends TranslationTest {
+
+ private final String KOTLIN_JS_LIB = TEST_DIR + "kotlin_lib.js";
+
+ @Override
+ protected void runWithRhino(String inputFile, String namespaceName,
+ String functionName, Object expectedResult) throws Exception {
+ Context cx = Context.enter();
+ FileReader testFileReader = new FileReader(inputFile);
+ FileReader libReader = new FileReader(KOTLIN_JS_LIB);
+ try {
+ Scriptable scope = cx.initStandardObjects();
+ cx.evaluateReader(scope, libReader, "lib", 1, null);
+ cx.evaluateReader(scope, testFileReader, "test case", 1, null);
+ Object result = extractAndCallFunctionObject(namespaceName, functionName, cx, scope);
+ assertTrue(result.equals(expectedResult));
+ String report = namespaceName + "." + functionName + "() = " + Context.toString(result);
+ System.out.println(report);
+
+ } finally {
+ Context.exit();
+ testFileReader.close();
+ }
+ }
+
+ @Test
+ public void kotlinJsLibRunsWithRhino() throws Exception {
+ runWithRhino(TEST_DIR + "testKotlinLib.js", "foo", "box", true);
+ }
+
+ @Test
+ public void classInstantiation() throws Exception {
+ testFooBoxIsTrue("classInstantiation.kt");
+ }
+
+}
diff --git a/test/org/jetbrains/k2js/test/FunctionTest.java b/test/org/jetbrains/k2js/test/FunctionTest.java
new file mode 100644
index 00000000000..e32171bdf33
--- /dev/null
+++ b/test/org/jetbrains/k2js/test/FunctionTest.java
@@ -0,0 +1,30 @@
+package org.jetbrains.k2js.test;
+
+import org.junit.Test;
+
+/**
+ * @author Talanov Pavel
+ */
+public final class FunctionTest extends TranslationTest {
+
+ @Test
+ public void currentTest() throws Exception {
+ testFooBoxIsTrue("test.kt");
+ }
+
+ @Test
+ public void testAssign() throws Exception {
+ performTest("assign.jet", "foo", "f", 2.0);
+ }
+
+ @Test
+ public void namespaceProperties() throws Exception {
+ performTest("localProperty.jet", "foo", "box", 50);
+ }
+
+ @Test
+ public void comparison() throws Exception {
+ testFooBoxIsTrue("comparison.kt");
+ }
+
+}
diff --git a/test/org/jetbrains/k2js/test/TranslationTest.java b/test/org/jetbrains/k2js/test/TranslationTest.java
new file mode 100644
index 00000000000..ae4ca0d61b4
--- /dev/null
+++ b/test/org/jetbrains/k2js/test/TranslationTest.java
@@ -0,0 +1,66 @@
+package org.jetbrains.k2js.test;
+
+import org.jetbrains.k2js.K2JSTranslator;
+import org.mozilla.javascript.Context;
+import org.mozilla.javascript.Function;
+import org.mozilla.javascript.NativeObject;
+import org.mozilla.javascript.Scriptable;
+
+import java.io.FileReader;
+import static org.junit.Assert.*;
+
+
+/**
+ * @author Talanov Pavel
+ */
+public class TranslationTest {
+
+ protected final static String TEST_DIR = "test_files/test_cases/";
+
+ protected void performTest(String inputFile, String namespaceName,
+ String functionName, Object expectedResult) throws Exception {
+ K2JSTranslator.Arguments args = new K2JSTranslator.Arguments();
+ args.src = TEST_DIR + inputFile;
+ args.outputDir = getOutputFilename(TEST_DIR + inputFile);
+ K2JSTranslator.translate(args);
+ runWithRhino(args.outputDir, namespaceName, functionName, expectedResult);
+ }
+
+ private String getOutputFilename(String inputFile) {
+ return inputFile.substring(0, inputFile.lastIndexOf('.')) + ".js";
+ }
+
+ protected void runWithRhino(String inputFile, String namespaceName,
+ String functionName, Object expectedResult) throws Exception {
+ Context cx = Context.enter();
+ FileReader reader = new FileReader(inputFile);
+ try {
+ Scriptable scope = cx.initStandardObjects();
+ cx.evaluateReader(scope, reader, "test case", 1, null);
+ Object result = extractAndCallFunctionObject(namespaceName, functionName, cx, scope);
+ assertTrue(result.equals(expectedResult));
+ String report = namespaceName + "." + functionName + "() = " + Context.toString(result);
+ System.out.println(report);
+
+ } finally {
+ Context.exit();
+ reader.close();
+ }
+ }
+
+ protected Object extractAndCallFunctionObject(String namespaceName, String functionName,
+ Context cx, Scriptable scope) {
+ Object foo = scope.get(namespaceName, scope);
+ assertTrue(foo instanceof NativeObject);
+ NativeObject namespaceObject = (NativeObject)foo;
+ Object box = namespaceObject.get(functionName, namespaceObject);
+ assertTrue(box instanceof Function);
+ Object functionArgs[] = {};
+ Function function = (Function)box;
+ return function.call(cx, scope, scope, functionArgs);
+ }
+
+ protected void testFooBoxIsTrue(String filename) throws Exception {
+ performTest(filename, "foo", "box", true);
+ }
+}
diff --git a/test/org/jetbrains/k2js/test/TranslatorTests.java b/test/org/jetbrains/k2js/test/TranslatorTests.java
deleted file mode 100644
index fa2e794097f..00000000000
--- a/test/org/jetbrains/k2js/test/TranslatorTests.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.jetbrains.k2js.test;
-
-import org.jetbrains.k2js.K2JSTranslator;
-import org.junit.Test;
-import org.mozilla.javascript.Context;
-import org.mozilla.javascript.Function;
-import org.mozilla.javascript.NativeObject;
-import org.mozilla.javascript.Scriptable;
-
-import java.io.FileReader;
-import static org.junit.Assert.*;
-
-
-/**
- * @author Talanov Pavel
- */
-public class TranslatorTests {
-
- private final static String TEST_DIR = "test_files/test_cases/";
-
- private void performTest(String inputFile) throws Exception {
- K2JSTranslator.Arguments args = new K2JSTranslator.Arguments();
- args.src = TEST_DIR + inputFile;
- args.outputDir = getOutputFilename(TEST_DIR + inputFile);
- K2JSTranslator.translate(args);
- runWithRhino(args.outputDir);
- }
-
- private String getOutputFilename(String inputFile) {
- return inputFile.substring(0, inputFile.lastIndexOf('.')) + ".js";
- }
-
- private void runWithRhino(String inputFile) throws Exception {
- Context cx = Context.enter();
- FileReader reader = new FileReader(inputFile);
- try {
- Scriptable scope = cx.initStandardObjects();
- cx.evaluateReader(scope, reader, "test case", 1, null);
-
- Object foo = scope.get("foo", scope);
- assertTrue(foo instanceof NativeObject);
- NativeObject namespaceObject = (NativeObject)foo;
- Object box = namespaceObject.get("box", namespaceObject);
- assertTrue(box instanceof Function);
- Object functionArgs[] = {};
- Function function = (Function) box;
- Object result = function.call(cx, scope, scope, functionArgs);
- assertTrue(result instanceof Boolean);
- assertTrue((Boolean)result == true);
- String report = "foo.box() = " + Context.toString(result);
- System.out.println(report);
-
- } finally {
- Context.exit();
- reader.close();
- }
- }
-
- @Test
- public void test() throws Exception {
- performTest("test.kt");
- }
-
- @Test
- public void testAssign() throws Exception {
- performTest("assign.jet");
- }
-
- @Test
- public void namespaceProperties() throws Exception {
- performTest("localProperty.jet");
- }
-
-}
diff --git a/test_files/test_cases/assign.jet b/test_files/test_cases/assign.jet
index 45948863891..75967d59a79 100644
--- a/test_files/test_cases/assign.jet
+++ b/test_files/test_cases/assign.jet
@@ -4,8 +4,4 @@ fun f(): Int {
var x: Int = 1
x = x + 1
return x
-}
-
-fun box() : Boolean {
- return (true)
}
\ No newline at end of file
diff --git a/test_files/test_cases/classInstantiation.kt b/test_files/test_cases/classInstantiation.kt
new file mode 100644
index 00000000000..72b9f442679
--- /dev/null
+++ b/test_files/test_cases/classInstantiation.kt
@@ -0,0 +1,9 @@
+namespace foo
+
+class Test() {
+}
+
+fun box() : Boolean {
+ var test = Test()
+ return true
+}
\ No newline at end of file
diff --git a/test_files/test_cases/comparison.kt b/test_files/test_cases/comparison.kt
new file mode 100644
index 00000000000..98ee81ba1ea
--- /dev/null
+++ b/test_files/test_cases/comparison.kt
@@ -0,0 +1,9 @@
+namespace foo
+
+fun box() : Boolean {
+ val a = 2;
+ val b = 3;
+ var c = 4;
+ return (a < c)
+}
+
diff --git a/test_files/test_cases/incrementProperty.jet b/test_files/test_cases/incrementProperty.jet
new file mode 100644
index 00000000000..7fba26d1359
--- /dev/null
+++ b/test_files/test_cases/incrementProperty.jet
@@ -0,0 +1,14 @@
+class Slot() {
+ var vitality: Int = 10000
+
+ fun increaseVitality(delta: Int) {
+ vitality += delta
+ if (vitality > 65535) vitality = 65535;
+ }
+}
+
+fun box(): Boolean {
+ val s = Slot()
+ s.increaseVitality(1000)
+ return (s.vitality == 11000)
+}
diff --git a/test_files/test_cases/kotlin_lib.js b/test_files/test_cases/kotlin_lib.js
new file mode 100644
index 00000000000..d3c9482a8a7
--- /dev/null
+++ b/test_files/test_cases/kotlin_lib.js
@@ -0,0 +1,288 @@
+function $A(iterable) {
+ if (!iterable) return [];
+ if ('toArray' in Object(iterable)) return iterable.toArray();
+ var length = iterable.length || 0, results = new Array(length);
+ while (length--) results[length] = iterable[length];
+ return results;
+}
+
+var emptyFunction = function() {}
+
+var Class = (function() {
+
+ var IS_DONTENUM_BUGGY = (function(){
+ for (var p in { toString: 1 }) {
+ if (p === 'toString') return false;
+ }
+ return true;
+ })();
+
+ function subclass() {};
+ function create() {
+ var parent = null, properties = $A(arguments);
+ if (Object.isFunction(properties[0]))
+ parent = properties.shift();
+
+ function klass() {
+ this.initialize.apply(this, arguments);
+ }
+
+ Object.extend(klass, Class.Methods);
+ klass.superclass = parent;
+ klass.subclasses = [];
+
+ if (parent) {
+ subclass.prototype = parent.prototype;
+ klass.prototype = new subclass;
+ parent.subclasses.push(klass);
+ }
+
+ for (var i = 0, length = properties.length; i < length; i++)
+ klass.addMethods(properties[i]);
+
+ if (!klass.prototype.initialize)
+ klass.prototype.initialize = emptyFunction;
+
+ klass.prototype.constructor = klass;
+ return klass;
+ }
+
+ function addMethods(source) {
+ var ancestor = this.superclass && this.superclass.prototype,
+ properties = Object.keys(source);
+
+ if (IS_DONTENUM_BUGGY) {
+ if (source.toString != Object.prototype.toString)
+ properties.push("toString");
+ if (source.valueOf != Object.prototype.valueOf)
+ properties.push("valueOf");
+ }
+
+ for (var i = 0, length = properties.length; i < length; i++) {
+ var property = properties[i], value = source[property];
+ if (ancestor && Object.isFunction(value) &&
+ value.argumentNames()[0] == "$super") {
+ var method = value;
+ value = (function(m) {
+ return function() { return ancestor[m].apply(this, arguments); };
+ })(property).wrap(method);
+
+ value.valueOf = method.valueOf.bind(method);
+ value.toString = method.toString.bind(method);
+ }
+ this.prototype[property] = value;
+ }
+
+ return this;
+ }
+
+ return {
+ create: create,
+ Methods: {
+ addMethods: addMethods
+ }
+ };
+})();
+
+
+
+(function() {
+
+ var _toString = Object.prototype.toString,
+ NULL_TYPE = 'Null',
+ UNDEFINED_TYPE = 'Undefined',
+ BOOLEAN_TYPE = 'Boolean',
+ NUMBER_TYPE = 'Number',
+ STRING_TYPE = 'String',
+ OBJECT_TYPE = 'Object',
+ FUNCTION_CLASS = '[object Function]',
+ BOOLEAN_CLASS = '[object Boolean]',
+ NUMBER_CLASS = '[object Number]',
+ STRING_CLASS = '[object String]',
+ ARRAY_CLASS = '[object Array]',
+ DATE_CLASS = '[object Date]';
+
+ function Type(o) {
+ switch(o) {
+ case null: return NULL_TYPE;
+ case (void 0): return UNDEFINED_TYPE;
+ }
+ var type = typeof o;
+ switch(type) {
+ case 'boolean': return BOOLEAN_TYPE;
+ case 'number': return NUMBER_TYPE;
+ case 'string': return STRING_TYPE;
+ }
+ return OBJECT_TYPE;
+ }
+
+ function extend(destination, source) {
+ for (var property in source)
+ destination[property] = source[property];
+ return destination;
+ }
+
+ function inspect(object) {
+ try {
+ if (isUndefined(object)) return 'undefined';
+ if (object === null) return 'null';
+ return object.inspect ? object.inspect() : String(object);
+ } catch (e) {
+ if (e instanceof RangeError) return '...';
+ throw e;
+ }
+ }
+
+ function toJSON(value) {
+ return Str('', { '': value }, []);
+ }
+
+ function Str(key, holder, stack) {
+ var value = holder[key],
+ type = typeof value;
+
+ if (Type(value) === OBJECT_TYPE && typeof value.toJSON === 'function') {
+ value = value.toJSON(key);
+ }
+
+ var _class = _toString.call(value);
+
+ switch (_class) {
+ case NUMBER_CLASS:
+ case BOOLEAN_CLASS:
+ case STRING_CLASS:
+ value = value.valueOf();
+ }
+
+ switch (value) {
+ case null: return 'null';
+ case true: return 'true';
+ case false: return 'false';
+ }
+
+ type = typeof value;
+ switch (type) {
+ case 'string':
+ return value.inspect(true);
+ case 'number':
+ return isFinite(value) ? String(value) : 'null';
+ case 'object':
+
+ for (var i = 0, length = stack.length; i < length; i++) {
+ if (stack[i] === value) { throw new TypeError(); }
+ }
+ stack.push(value);
+
+ var partial = [];
+ if (_class === ARRAY_CLASS) {
+ for (var i = 0, length = value.length; i < length; i++) {
+ var str = Str(i, value, stack);
+ partial.push(typeof str === 'undefined' ? 'null' : str);
+ }
+ partial = '[' + partial.join(',') + ']';
+ } else {
+ var keys = Object.keys(value);
+ for (var i = 0, length = keys.length; i < length; i++) {
+ var key = keys[i], str = Str(key, value, stack);
+ if (typeof str !== "undefined") {
+ partial.push(key.inspect(true)+ ':' + str);
+ }
+ }
+ partial = '{' + partial.join(',') + '}';
+ }
+ stack.pop();
+ return partial;
+ }
+ }
+
+ function stringify(object) {
+ return JSON.stringify(object);
+ }
+
+ function toQueryString(object) {
+ return $H(object).toQueryString();
+ }
+
+ function toHTML(object) {
+ return object && object.toHTML ? object.toHTML() : String.interpret(object);
+ }
+
+ function keys(object) {
+ if (Type(object) !== OBJECT_TYPE) { throw new TypeError(); }
+ var results = [];
+ for (var property in object) {
+ if (object.hasOwnProperty(property)) {
+ results.push(property);
+ }
+ }
+ return results;
+ }
+
+ function values(object) {
+ var results = [];
+ for (var property in object)
+ results.push(object[property]);
+ return results;
+ }
+
+ function clone(object) {
+ return extend({ }, object);
+ }
+
+ function isElement(object) {
+ return !!(object && object.nodeType == 1);
+ }
+
+ function isArray(object) {
+ return _toString.call(object) === ARRAY_CLASS;
+ }
+
+ var hasNativeIsArray = (typeof Array.isArray == 'function')
+ && Array.isArray([]) && !Array.isArray({});
+
+ if (hasNativeIsArray) {
+ isArray = Array.isArray;
+ }
+
+ function isHash(object) {
+ return object instanceof Hash;
+ }
+
+ function isFunction(object) {
+ return _toString.call(object) === FUNCTION_CLASS;
+ }
+
+ function isString(object) {
+ return _toString.call(object) === STRING_CLASS;
+ }
+
+ function isNumber(object) {
+ return _toString.call(object) === NUMBER_CLASS;
+ }
+
+ function isDate(object) {
+ return _toString.call(object) === DATE_CLASS;
+ }
+
+ function isUndefined(object) {
+ return typeof object === "undefined";
+ }
+
+ extend(Object, {
+ extend: extend,
+ inspect: inspect,
+ toQueryString: toQueryString,
+ toHTML: toHTML,
+ keys: Object.keys || keys,
+ values: values,
+ clone: clone,
+ isElement: isElement,
+ isArray: isArray,
+ isHash: isHash,
+ isFunction: isFunction,
+ isString: isString,
+ isNumber: isNumber,
+ isDate: isDate,
+ isUndefined: isUndefined
+ });
+})();
\ No newline at end of file
diff --git a/test_files/test_cases/localProperty.jet b/test_files/test_cases/localProperty.jet
index 2e3600d5cf0..1f2f52fce72 100644
--- a/test_files/test_cases/localProperty.jet
+++ b/test_files/test_cases/localProperty.jet
@@ -9,7 +9,7 @@ fun f(a:Int) : Int {
return y
}
-fun box() : Boolean
+fun box() : Int
{
- return (f(3) == 50)
+ return f(y)
}
diff --git a/test_files/test_cases/prototype.js b/test_files/test_cases/prototype.js
new file mode 100644
index 00000000000..9474d0e2189
--- /dev/null
+++ b/test_files/test_cases/prototype.js
@@ -0,0 +1,6008 @@
+/* Prototype JavaScript framework, version 1.7
+ * (c) 2005-2010 Sam Stephenson
+ *
+ * Prototype is freely distributable under the terms of an MIT-style license.
+ * For details, see the Prototype web site: http://www.prototypejs.org/
+ *
+ *--------------------------------------------------------------------------*/
+
+var Prototype = {
+
+ Version: '1.7',
+
+ Browser: (function(){
+ var ua = navigator.userAgent;
+ var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]';
+ return {
+ IE: !!window.attachEvent && !isOpera,
+ Opera: isOpera,
+ WebKit: ua.indexOf('AppleWebKit/') > -1,
+ Gecko: ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') === -1,
+ MobileSafari: /Apple.*Mobile/.test(ua)
+ }
+ })(),
+
+ BrowserFeatures: {
+ XPath: !!document.evaluate,
+
+ SelectorsAPI: !!document.querySelector,
+
+ ElementExtensions: (function() {
+ var constructor = window.Element || window.HTMLElement;
+ return !!(constructor && constructor.prototype);
+ })(),
+ SpecificElementExtensions: (function() {
+ if (typeof window.HTMLDivElement !== 'undefined')
+ return true;
+
+ var div = document.createElement('div'),
+ form = document.createElement('form'),
+ isSupported = false;
+
+ if (div['__proto__'] && (div['__proto__'] !== form['__proto__'])) {
+ isSupported = true;
+ }
+
+ div = form = null;
+
+ return isSupported;
+ })()
+ },
+
+ ScriptFragment: '