diff --git a/js/src/com/google/dart/compiler/util/AstUtil.java b/js/src/com/google/dart/compiler/util/AstUtil.java index bf599da1cd7..4e92a7f4fe0 100644 --- a/js/src/com/google/dart/compiler/util/AstUtil.java +++ b/js/src/com/google/dart/compiler/util/AstUtil.java @@ -308,15 +308,15 @@ public class AstUtil { throw new AssertionError("Set qualifier should be applied only to JsInvocation or JsNameRef instances"); } - public static JsExpression equals(JsExpression arg1, JsExpression arg2) { + public static JsBinaryOperation equals(JsExpression arg1, JsExpression arg2) { return new JsBinaryOperation(JsBinaryOperator.REF_EQ, arg1, arg2); } + public static JsBinaryOperation notEqual(JsExpression arg1, JsExpression arg2) { + return new JsBinaryOperation(JsBinaryOperator.REF_NEQ, arg1, arg2); + } + public static JsExpression equalsTrue(JsExpression expression, JsProgram program) { return equals(expression, program.getTrueLiteral()); } - - public static void thisQualify(JsExpression expression) { - setQualifier(expression, new JsThisRef()); - } } diff --git a/translator/src/org/jetbrains/k2js/declarations/ExtractionVisitor.java b/translator/src/org/jetbrains/k2js/declarations/ExtractionVisitor.java index 4e16bf9dea6..6bfd26df152 100644 --- a/translator/src/org/jetbrains/k2js/declarations/ExtractionVisitor.java +++ b/translator/src/org/jetbrains/k2js/declarations/ExtractionVisitor.java @@ -71,6 +71,7 @@ public final class ExtractionVisitor extends DeclarationDescriptorVisitor> propertyToType + = new HashMap>(); + propertyToType.put("create", Function.class); + runPropertyTypeCheck("Namespace", propertyToType); + } + @Test public void traitObjectHasCreateMethod() throws Exception { final Map> propertyToType diff --git a/translator/testFiles/kotlin_lib.js b/translator/testFiles/kotlin_lib.js index 9eccea4f81b..e525c5d3f83 100644 --- a/translator/testFiles/kotlin_lib.js +++ b/translator/testFiles/kotlin_lib.js @@ -127,6 +127,19 @@ var Trait = (function() { }; })(); + + +var Namespace = (function() { + + function create() { + return Class.create.apply(this, arguments); + } + + return { + create: create + }; +})(); + (function() { var _toString = Object.prototype.toString,