run code coverage

eliminate dead and unuseful code
This commit is contained in:
Pavel Talanov
2012-02-01 00:20:17 +04:00
parent 47252655c9
commit b43b559ca6
26 changed files with 65 additions and 225 deletions
@@ -22,6 +22,9 @@ import java.util.List;
*/
public final class Analyzer {
private Analyzer() {
}
@NotNull
public static BindingContext analyzeFilesAndCheckErrors(@NotNull List<JetFile> files,
@NotNull Config config) {
@@ -57,7 +60,7 @@ public final class Analyzer {
@Override
public boolean apply(@Nullable PsiFile file) {
assert file instanceof JetFile;
boolean notLibFile = !jsLibFiles.contains(file);
@SuppressWarnings("UnnecessaryLocalVariable") boolean notLibFile = !jsLibFiles.contains(file);
return notLibFile;
}
};
@@ -88,7 +91,4 @@ public final class Analyzer {
@NotNull WritableScope namespaceMemberScope) {
}
}
private Analyzer() {
}
}
@@ -19,12 +19,6 @@ public final class CodeGenerator {
private final TextOutput output = new DefaultTextOutput(false);
public CodeGenerator() {
}
public void generateToConsole(@NotNull JsProgram program) {
generateCode(program);
System.out.println(output.toString());
}
public void generateToFile(@NotNull JsProgram program, @NotNull File file) throws IOException {
@@ -36,12 +36,6 @@ public final class StandardClasses {
return this;
}
private void externalObject(@NotNull String nativeName) {
currentObjectName = nativeName;
assert currentFQName != null;
declareExternalTopLevelObject(currentFQName, nativeName);
}
private void kotlinTopLevelObject(@NotNull String kotlinName) {
assert currentFQName != null;
currentObjectName = kotlinName;
@@ -78,9 +72,8 @@ public final class StandardClasses {
}
@NotNull
public static StandardClasses bindImplementations(@NotNull JsScope kotlinObjectScope,
@NotNull JsScope rootScope) {
StandardClasses standardClasses = new StandardClasses(kotlinObjectScope, rootScope);
public static StandardClasses bindImplementations(@NotNull JsScope kotlinObjectScope) {
StandardClasses standardClasses = new StandardClasses(kotlinObjectScope);
declareJetObjects(standardClasses);
return standardClasses;
}
@@ -93,9 +86,6 @@ public final class StandardClasses {
standardClasses.declare().forFQ("jet.IntRange").kotlinClass("NumberRange")
.methods("iterator", "contains").properties("start", "size", "end", "reversed");
// standardClasses.declare().forFQ("jet.String").kotlinClass("String").
// properties("length");
standardClasses.declare().forFQ("jet.Any.toString").kotlinFunction("toString");
}
@@ -103,20 +93,14 @@ public final class StandardClasses {
@NotNull
private final JsScope kotlinScope;
@NotNull
private final JsScope rootScope;
@NotNull
private final Map<String, JsName> standardObjects = new HashMap<String, JsName>();
@NotNull
private final Map<String, JsName> externalObjects = new HashMap<String, JsName>();
@NotNull
private final Map<String, JsScope> scopeMap = new HashMap<String, JsScope>();
private StandardClasses(@NotNull JsScope kotlinScope, @NotNull JsScope rootScope) {
this.rootScope = rootScope;
private StandardClasses(@NotNull JsScope kotlinScope) {
this.kotlinScope = kotlinScope;
}
@@ -132,10 +116,6 @@ public final class StandardClasses {
declareTopLevelObjectInScope(kotlinScope, standardObjects, fullQualifiedName, kotlinLibName);
}
private void declareExternalTopLevelObject(@NotNull String fullQualifiedName, @NotNull String externalObjectName) {
declareTopLevelObjectInScope(rootScope, externalObjects, fullQualifiedName, externalObjectName);
}
private void declareInner(@NotNull String fullQualifiedClassName,
@NotNull String shortMethodName,
@NotNull String javascriptName) {
@@ -165,15 +145,6 @@ public final class StandardClasses {
return standardObjects.containsKey(getFQName(descriptor));
}
public boolean isExternalObject(@NotNull DeclarationDescriptor descriptor) {
return externalObjects.containsKey(getFQName(descriptor));
}
@NotNull
public JsName getExternalObjectName(@NotNull DeclarationDescriptor descriptor) {
return externalObjects.get(getFQName(descriptor));
}
@NotNull
public JsName getStandardObjectName(@NotNull DeclarationDescriptor descriptor) {
return standardObjects.get(getFQName(descriptor));
@@ -26,7 +26,7 @@ public class StaticContext {
DeclarationFacade declarations = DeclarationFacade.createFacade(scope);
Intrinsics intrinsics = Intrinsics.standardLibraryIntrinsics(library);
StandardClasses standardClasses =
StandardClasses.bindImplementations(namer.getKotlinScope(), jsRootScope);
StandardClasses.bindImplementations(namer.getKotlinScope());
return new StaticContext(program, bindingContext, declarations, aliaser,
namer, intrinsics, standardClasses, scope);
}
@@ -111,21 +111,6 @@ public class StaticContext {
return standardClasses;
}
@NotNull
public Declarations getLibraryDeclarations() {
return declarationFacade.getJetLibraryDeclarations();
}
@NotNull
public Declarations getNativeDeclarations() {
return declarationFacade.getKotlinDeclarations();
}
@NotNull
public Declarations getKotlinDeclarations() {
return declarationFacade.getKotlinDeclarations();
}
//TODO: helper method outdated
@NotNull
public NamingScope getScopeForDescriptor(@NotNull DeclarationDescriptor descriptor) {
@@ -105,12 +105,10 @@ public final class TranslationContext {
@NotNull
public JsName getNameForDescriptor(@NotNull DeclarationDescriptor descriptor) {
//TODO: rewrite
if (aliaser().hasAliasForDeclaration(descriptor)) {
return aliaser().getAliasForDeclaration(descriptor);
}
if (standardClasses().isExternalObject(descriptor)) {
return standardClasses().getExternalObjectName(descriptor);
}
if (standardClasses().isStandardObject(descriptor)) {
return standardClasses().getStandardObjectName(descriptor);
}
@@ -195,6 +193,7 @@ public final class TranslationContext {
return dynamicContext.jsBlock();
}
//TODO: deletE?
@NotNull
private DeclarationFacade declarationFacade() {
return staticContext.getDeclarationFacade();
@@ -35,6 +35,8 @@ public abstract class AbstractDeclarationVisitor extends DeclarationDescriptorVi
abstract protected boolean accept(@NotNull DeclarationDescriptor descriptor);
abstract public void traverseNamespace(@NotNull NamespaceDescriptor namespace, @NotNull DeclarationContext context);
@NotNull
protected Declarations declarations() {
return declarations;
@@ -100,9 +102,7 @@ public abstract class AbstractDeclarationVisitor extends DeclarationDescriptorVi
@Override
public Void visitConstructorDescriptor(@NotNull ConstructorDescriptor descriptor,
@NotNull DeclarationContext context) {
if (!accept(descriptor)) {
return null;
}
assert accept(descriptor) : "Must accept constructor fot he class we accepted";
JsName alreadyDeclaredClassName = declarations.getName(descriptor.getContainingDeclaration());
//already defined in
declarations.putName(descriptor, alreadyDeclaredClassName);
@@ -161,17 +161,10 @@ public abstract class AbstractDeclarationVisitor extends DeclarationDescriptorVi
return null;
}
public void traverseNamespace(@NotNull NamespaceDescriptor descriptor, @NotNull DeclarationContext context) {
if (!accept(descriptor)) {
return;
}
DeclarationContext namespaceContext = extractNamespaceDeclaration(descriptor, context);
declareMembers(descriptor, namespaceContext);
}
@NotNull
private DeclarationContext extractNamespaceDeclaration(@NotNull NamespaceDescriptor descriptor,
@NotNull DeclarationContext context) {
protected DeclarationContext extractNamespaceDeclaration(@NotNull NamespaceDescriptor descriptor,
@NotNull DeclarationContext context) {
String nameForNamespace = getNameForNamespace(descriptor);
JsName namespaceName = doDeclareName(descriptor, context, nameForNamespace);
NamingScope namespaceScope = doDeclareScope(descriptor, context, "namespace " + namespaceName.getIdent());
@@ -106,11 +106,6 @@ public class AnnotatedDeclarationVisitor extends AbstractDeclarationVisitor {
throw new AssertionError("Use isAnnotatedClass to check");
}
public boolean isAnnotatedDeclaration(@NotNull DeclarationDescriptor descriptor) {
return hasClassAnnotation(descriptor) || hasFunctionAnnotation(descriptor)
|| declaredInAnnotatedClass(descriptor);
}
public boolean isAnnotatedFunction(@NotNull FunctionDescriptor functionDescriptor) {
return hasFunctionAnnotation(functionDescriptor) || declaredInAnnotatedClass(functionDescriptor);
}
@@ -3,6 +3,7 @@ package org.jetbrains.k2js.translate.context.declaration;
import com.google.dart.compiler.backend.js.ast.JsName;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
import org.jetbrains.k2js.translate.context.NamingScope;
import static org.jetbrains.k2js.translate.context.declaration.AnnotationsUtils.doesNotHaveInternalAnnotations;
@@ -42,4 +43,10 @@ public final class KotlinDeclarationVisitor extends AbstractDeclarationVisitor {
protected boolean accept(@NotNull DeclarationDescriptor descriptor) {
return (doesNotHaveInternalAnnotations(descriptor));
}
@Override
public void traverseNamespace(@NotNull NamespaceDescriptor descriptor, @NotNull DeclarationContext context) {
DeclarationContext namespaceContext = extractNamespaceDeclaration(descriptor, context);
declareMembers(descriptor, namespaceContext);
}
}
@@ -15,7 +15,6 @@ import org.jetbrains.jet.lang.psi.JetParameter;
import org.jetbrains.k2js.translate.context.TranslationContext;
import org.jetbrains.k2js.translate.general.AbstractTranslator;
import org.jetbrains.k2js.translate.general.Translation;
import org.jetbrains.k2js.translate.reference.ReferenceTranslator;
import org.jetbrains.k2js.translate.utils.BindingUtils;
import java.util.ArrayList;
@@ -107,9 +106,8 @@ public final class ClassTranslator extends AbstractTranslator {
// in future it might change
if (aliaser().hasAliasForDeclaration(superClassDescriptor)) {
return context().aliaser().getAliasForDeclaration(superClassDescriptor).makeRef();
} else {
return ReferenceTranslator.translateAsFQReference(superClassDescriptor, context());
}
throw new AssertionError("Inherited from unknown class");
}
@Nullable
@@ -56,6 +56,15 @@ public final class ExpressionVisitor extends TranslatorVisitor<JsNode> {
if (value instanceof Boolean) {
return context.program().getBooleanLiteral((Boolean) value);
}
//TODO: test
if (value instanceof Float) {
return context.program().getNumberLiteral((Float) value);
}
if (value instanceof Double) {
return context.program().getNumberLiteral((Double) value);
}
//TODO: all values
throw new AssertionError("Unsupported constant expression" + expression.toString());
}
@@ -60,7 +60,6 @@ public final class PatternTranslator extends AbstractTranslator {
@NotNull
private JsExpression translateTypePattern(@NotNull JsExpression expressionToMatch,
@NotNull JetTypePattern pattern) {
//TODO: HACK to make some examples work
//TODO: look into using intrinsics or other mechanisms to implement this logic
JsName className = getClassReference(pattern).getName();
if (className.getIdent().equals("String")) {
@@ -1,6 +1,8 @@
package org.jetbrains.k2js.translate.expression;
import com.google.dart.compiler.backend.js.ast.*;
import com.google.dart.compiler.backend.js.ast.JsConditional;
import com.google.dart.compiler.backend.js.ast.JsExpression;
import com.google.dart.compiler.backend.js.ast.JsNullLiteral;
import com.google.dart.compiler.util.AstUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.psi.*;
@@ -12,6 +14,7 @@ import org.jetbrains.k2js.translate.reference.PropertyAccessTranslator;
import static org.jetbrains.k2js.translate.general.Translation.translateAsExpression;
import static org.jetbrains.k2js.translate.utils.PsiUtils.getNotNullSimpleNameSelector;
import static org.jetbrains.k2js.translate.utils.PsiUtils.getSelector;
import static org.jetbrains.k2js.translate.utils.TranslationUtils.notNullCheck;
/**
@@ -47,20 +50,11 @@ public final class QualifiedExpressionTranslator {
@NotNull
public static JsExpression translateDotQualifiedExpression(@NotNull JetDotQualifiedExpression expression,
@NotNull TranslationContext context) {
//TODO: problem with extension properties lies here
JsExpression receiver = translateReceiver(expression, context);
JetExpression selector = getSelector(expression);
return translate(receiver, selector, context);
}
@NotNull
private static JetExpression getSelector(@NotNull JetQualifiedExpression expression) {
JetExpression selector = expression.getSelectorExpression();
//TODO: util?
assert selector != null;
return selector;
}
@NotNull
private static JsExpression translate(@NotNull JsExpression receiver, @NotNull JetExpression selector,
@NotNull TranslationContext context) {
@@ -71,22 +65,7 @@ public final class QualifiedExpressionTranslator {
if (selector instanceof JetCallExpression) {
return CallTranslator.translate((JetCallExpression) selector, receiver, context);
}
return composeQualifiedExpression(receiver, translateAsExpression(selector, context));
}
@NotNull
private static JsExpression composeQualifiedExpression(@NotNull JsExpression receiver, @NotNull JsExpression selector) {
//TODO: make sure that logic would not break for binary operation. check if there is a way to provide clearer logic
assert (selector instanceof JsNameRef || selector instanceof JsInvocation || selector instanceof JsBinaryOperation)
: "Selector should be a name reference or a method invocation in dot qualified expression.";
if (selector instanceof JsInvocation) {
return translateAsQualifiedInvocation(receiver, (JsInvocation) selector);
} else if (selector instanceof JsNameRef) {
return translateAsQualifiedNameReference(receiver, (JsNameRef) selector);
} else {
((JsBinaryOperation) selector).setArg1(receiver);
return selector;
}
throw new AssertionError("Unexpected qualified expression");
}
@NotNull
@@ -94,18 +73,4 @@ public final class QualifiedExpressionTranslator {
@NotNull TranslationContext context) {
return translateAsExpression(expression.getReceiverExpression(), context);
}
@NotNull
private static JsExpression translateAsQualifiedNameReference(@NotNull JsExpression receiver, @NotNull JsNameRef selector) {
selector.setQualifier(receiver);
return selector;
}
@NotNull
private static JsExpression translateAsQualifiedInvocation(@NotNull JsExpression receiver, @NotNull JsInvocation selector) {
JsExpression qualifier = selector.getQualifier();
JsNameRef nameRef = (JsNameRef) qualifier;
nameRef.setQualifier(receiver);
return selector;
}
}
@@ -19,6 +19,7 @@ import static com.google.dart.compiler.util.AstUtil.convertToBlock;
/**
* @author Pavel Talanov
*/
//TODO: not tested at all
//TODO: not implemented catch logic
public final class TryTranslator extends AbstractTranslator {
@@ -81,12 +81,4 @@ public final class InitializerVisitor extends TranslatorVisitor<List<JsStatement
}
return initializerStatements;
}
@NotNull
public List<JsStatement> traverse(@NotNull JetDeclaration declaration, @NotNull TranslationContext context) {
if (declaration instanceof JetClass) {
return traverseClass((JetClass) declaration, context);
}
throw new AssertionError("Cannot traverse anything else.");
}
}
@@ -75,7 +75,8 @@ public final class Intrinsics {
}
private void declareNullConstructorIntrinsic() {
FunctionDescriptor nullArrayConstructor = getFunctionByName(library.getLibraryScope(), "Array");
//TODO:
FunctionDescriptor nullArrayConstructor = library.getLibraryScope().getFunctions("Array").iterator().next();
functionIntrinsics.put(nullArrayConstructor, ArrayNullConstructorIntrinsic.INSTANCE);
}
@@ -23,10 +23,6 @@ public enum ArrayGetIntrinsic implements FunctionIntrinsic {
assert receiver != null;
assert arguments.size() == 1 : "Array get expression must have one argument.";
JsExpression indexExpression = arguments.get(0);
// TemporaryVariable arrayExpression = context.declareTemporary(receiver);
// JsConditional indexInBoundsCheck =
// IntrinsicArrayUtils.indexInBoundsCheck(indexExpression, arrayExpression, context);
// return AstUtil.newSequence(arrayExpression.assignmentExpression(), AstUtil.newArrayAccess(receiver, indexExpression));
return new JsArrayAccess(receiver, indexExpression);
}
}
@@ -1,43 +0,0 @@
package org.jetbrains.k2js.translate.intrinsic.array;
import com.google.dart.compiler.backend.js.ast.*;
import com.google.dart.compiler.util.AstUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.k2js.translate.context.TemporaryVariable;
import org.jetbrains.k2js.translate.context.TranslationContext;
import static org.jetbrains.k2js.translate.utils.TranslationUtils.zeroLiteral;
//TODO: decide if needed
/**
* @author Pavel Talanov
*/
public final class IntrinsicArrayUtils {
private IntrinsicArrayUtils() {
}
@NotNull
public static JsConditional indexInBoundsCheck(@NotNull JsExpression indexExpression,
@NotNull TemporaryVariable arrayTemporary,
@NotNull TranslationContext context) {
JsExpression positiveOrZero = new JsBinaryOperation
(JsBinaryOperator.GTE, indexExpression, zeroLiteral(context));
JsNameRef lengthExpression = AstUtil.newQualifiedNameRef("length");
lengthExpression.setQualifier(arrayTemporary.nameReference());
JsExpression lessThanLength = new JsBinaryOperation
(JsBinaryOperator.LT, indexExpression, lengthExpression);
JsExpression indexInBounds = AstUtil.and(positiveOrZero, lessThanLength);
JsConditional indexCheck = new JsConditional();
indexCheck.setTestExpression(indexInBounds);
indexCheck.setElseExpression(throwOutOfBoundsException());
return indexCheck;
}
@NotNull
private static JsExpression throwOutOfBoundsException() {
//TODO: think about exception
return AstUtil.newQualifiedNameRef("ErrorName");
}
}
@@ -87,6 +87,7 @@ public abstract class IncrementTranslator extends AbstractTranslator {
variableReassignment, t2.nameReference());
}
//TODO: TEST
@NotNull
private JsExpression asPostfixWithNoReassignment() {
// code fragment: expr(a++)
@@ -86,19 +86,6 @@ public final class CallTranslator extends AbstractTranslator {
return new CallTranslator(receiver, callee, arguments, resolvedCall, null, context);
}
//TODO: inspect dead code
@Nullable
private JsExpression translateCalleeIfExpressionAsFunction(@NotNull JetCallExpression callExpression) {
//TODO: util
JetExpression calleeExpression = callExpression.getCalleeExpression();
assert calleeExpression != null;
JsExpression callee = null;
if (isExpressionAsFunction(context.bindingContext(), calleeExpression)) {
callee = Translation.translateAsExpression(calleeExpression, context);
}
return callee;
}
@NotNull
private List<JsExpression> translateArgumentsForCallExpression(@NotNull JetCallExpression callExpression,
@NotNull TranslationContext context) {
@@ -26,9 +26,6 @@ import static org.jetbrains.k2js.translate.utils.TranslationUtils.backingFieldRe
*/
public final class PropertyAccessTranslator extends AccessTranslator {
private static final String MESSAGE = "Cannot be accessor call. Use canBeProperty*Call to ensure this method " +
"can be called safely.";
@NotNull
private static PropertyDescriptor getPropertyDescriptor(@NotNull JetSimpleNameExpression expression,
@NotNull TranslationContext context) {
@@ -76,6 +73,7 @@ public final class PropertyAccessTranslator extends AccessTranslator {
@NotNull TranslationContext context) {
JetSimpleNameExpression selector = getSelectorAsSimpleName(expression);
if (selector == null) {
//TODO: never get there. review
return false;
}
return canBePropertyGetterCall(selector, context);
@@ -5,7 +5,6 @@ import com.google.dart.compiler.backend.js.ast.JsName;
import com.google.dart.compiler.util.AstUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
import org.jetbrains.jet.lang.psi.JetSimpleNameExpression;
import org.jetbrains.k2js.translate.context.TranslationContext;
@@ -41,13 +40,7 @@ public final class ReferenceTranslator {
@NotNull
public static JsExpression translateAsLocalNameReference(@NotNull DeclarationDescriptor referencedDescriptor,
@NotNull TranslationContext context) {
//TODO: prove correctness
if ((referencedDescriptor.getContainingDeclaration() instanceof NamespaceDescriptor)
&& (context.hasQualifierForDescriptor(referencedDescriptor))) {
assert context.hasQualifierForDescriptor(referencedDescriptor) : referencedDescriptor;
return translateAsFQReference(referencedDescriptor, context);
}
JsName referencedName = context.getNameForDescriptor(referencedDescriptor);
return referencedName.makeRef();
}
@@ -6,7 +6,6 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.lang.resolve.calls.ExpressionAsFunctionDescriptor;
import org.jetbrains.jet.lang.resolve.calls.ResolvedCall;
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
import org.jetbrains.jet.lang.types.JetStandardClasses;
@@ -99,6 +98,7 @@ public final class BindingUtils {
@NotNull DeclarationDescriptor descriptor) {
PsiElement result = context.get(BindingContext.DESCRIPTOR_TO_DECLARATION, descriptor);
if (result == null) {
//TODO: never get there
return null;
}
assert result instanceof JetDeclaration : "Descriptor should correspond to an element.";
@@ -207,6 +207,8 @@ public final class BindingUtils {
return !superClassDescriptor.equals(JetStandardClasses.getAny());
}
//TODO: check where we use there, suspicious
public static boolean isOwnedByNamespace(@NotNull DeclarationDescriptor descriptor) {
if (descriptor instanceof ConstructorDescriptor) {
DeclarationDescriptor classDescriptor = descriptor.getContainingDeclaration();
@@ -310,15 +312,4 @@ public final class BindingUtils {
assert hasNextDescriptor != null : "Range expression must have a descriptor for hasNext function or property.";
return hasNextDescriptor;
}
public static boolean isExpressionAsFunction(@NotNull BindingContext context,
@NotNull JetExpression calleeExpression) {
DeclarationDescriptor declarationDescriptor =
context.get(BindingContext.DECLARATION_TO_DESCRIPTOR, calleeExpression);
if (declarationDescriptor == null) {
return false;
}
return (declarationDescriptor instanceof ExpressionAsFunctionDescriptor);
}
}
@@ -60,13 +60,6 @@ public final class DescriptorUtils {
return resultingList;
}
@NotNull
public static FunctionDescriptor getFunctionByName(@NotNull ClassDescriptor classDescriptor,
@NotNull String name) {
JetScope scope = classDescriptor.getDefaultType().getMemberScope();
return getFunctionByName(scope, name);
}
@NotNull
public static FunctionDescriptor getFunctionByName(@NotNull JetScope scope,
@NotNull String name) {
@@ -17,14 +17,20 @@ public final class PsiUtils {
@Nullable
public static JetSimpleNameExpression getSelectorAsSimpleName(@NotNull JetQualifiedExpression expression) {
JetExpression selectorExpression = expression.getSelectorExpression();
assert selectorExpression != null : "Selector should not be null.";
JetExpression selectorExpression = getSelector(expression);
if (!(selectorExpression instanceof JetSimpleNameExpression)) {
return null;
}
return (JetSimpleNameExpression) selectorExpression;
}
@NotNull
public static JetExpression getSelector(@NotNull JetQualifiedExpression expression) {
JetExpression selectorExpression = expression.getSelectorExpression();
assert selectorExpression != null : "Selector should not be null.";
return selectorExpression;
}
@NotNull
public static JetSimpleNameExpression getNotNullSimpleNameSelector(@NotNull JetQualifiedExpression expression) {
JetSimpleNameExpression selectorAsSimpleName = getSelectorAsSimpleName(expression);
@@ -49,9 +49,7 @@ public final class TranslationUtils {
@NotNull
private static JsExpression translateArgument(@NotNull TranslationContext context, @NotNull ValueArgument argument) {
JetExpression jetExpression = argument.getArgumentExpression();
if (jetExpression == null) {
throw new AssertionError("Argument with no expression encountered!");
}
assert jetExpression != null : "Argument with no expression";
return Translation.translateAsExpression(jetExpression, context);
}
@@ -148,6 +146,7 @@ public final class TranslationUtils {
return Translation.translateAsExpression(baseExpression, context);
}
//TODO:
@NotNull
public static JsExpression translateReceiver(@NotNull TranslationContext context,
@NotNull JetDotQualifiedExpression expression) {
+10
View File
@@ -519,6 +519,16 @@
return obj.toString();
};
Kotlin.jsonFromTuples = function(pairArr) {
var i = pairArr.length;
var res = {};
while (i > 0) {
--i;
res[pairArr[i][0]] = pairArr[i][1];
}
return res;
};
/**
* Copyright 2010 Tim Down.