refactor and TODO clean-up
This commit is contained in:
@@ -309,28 +309,6 @@ public class AstUtil {
|
|||||||
throw new AssertionError("Set qualifier should be applied only to JsInvocation or JsNameRef instances");
|
throw new AssertionError("Set qualifier should be applied only to JsInvocation or JsNameRef instances");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JsExpression getQualifier(JsExpression expression) {
|
|
||||||
if (expression instanceof JsInvocation) {
|
|
||||||
return ((JsInvocation) expression).getQualifier();
|
|
||||||
}
|
|
||||||
if (expression instanceof JsNameRef) {
|
|
||||||
return ((JsNameRef) expression).getQualifier();
|
|
||||||
}
|
|
||||||
throw new AssertionError("Get qualifier should be applied only to JsInvocation or JsNameRef instances");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void substituteTopLevelQualifier(JsExpression expression, JsExpression substitutor) {
|
|
||||||
assert expression != null;
|
|
||||||
JsExpression previous = expression;
|
|
||||||
JsExpression current = getQualifier(expression);
|
|
||||||
assert current != null : "Cannot be applied to unqualified expression";
|
|
||||||
while (getQualifier(current) != null) {
|
|
||||||
previous = current;
|
|
||||||
current = getQualifier(current);
|
|
||||||
}
|
|
||||||
setQualifier(previous, substitutor);
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: look for should-be-usages
|
//TODO: look for should-be-usages
|
||||||
public static JsNameRef qualified(JsName selector, JsExpression qualifier) {
|
public static JsNameRef qualified(JsName selector, JsExpression qualifier) {
|
||||||
JsNameRef reference = selector.makeRef();
|
JsNameRef reference = selector.makeRef();
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import com.google.dart.compiler.util.AstUtil;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||||
|
|
||||||
//TODO: track that temporary declarations is in the scope of the block where they are declared
|
|
||||||
|
|
||||||
public class DynamicContext {
|
public class DynamicContext {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -106,7 +106,6 @@ public final class NamingScope {
|
|||||||
return (getName(descriptor.getOriginal()) != null);
|
return (getName(descriptor.getOriginal()) != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO protect global namespace
|
|
||||||
public JsName declareTemporary() {
|
public JsName declareTemporary() {
|
||||||
return scope.declareTemporary();
|
return scope.declareTemporary();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import static com.google.dart.compiler.util.AstUtil.convertToBlock;
|
|||||||
/**
|
/**
|
||||||
* @author Pavel Talanov
|
* @author Pavel Talanov
|
||||||
*/
|
*/
|
||||||
|
//TODO: not implemented catch logic
|
||||||
public final class TryTranslator extends AbstractTranslator {
|
public final class TryTranslator extends AbstractTranslator {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import static org.jetbrains.k2js.translate.utils.TranslationUtils.isIntrinsicOpe
|
|||||||
/**
|
/**
|
||||||
* @author Pavel Talanov
|
* @author Pavel Talanov
|
||||||
*/
|
*/
|
||||||
|
// TODO: provide better increment translator logic
|
||||||
public abstract class IncrementTranslator extends AbstractTranslator {
|
public abstract class IncrementTranslator extends AbstractTranslator {
|
||||||
|
|
||||||
public static boolean isIncrement(@NotNull JetUnaryExpression expression) {
|
public static boolean isIncrement(@NotNull JetUnaryExpression expression) {
|
||||||
|
|||||||
-1
@@ -12,7 +12,6 @@ import static org.jetbrains.k2js.translate.utils.TranslationUtils.getMethodRefer
|
|||||||
/**
|
/**
|
||||||
* @author Pavel Talanov
|
* @author Pavel Talanov
|
||||||
*/
|
*/
|
||||||
// TODO: provide better increment translator logic
|
|
||||||
public final class OverloadedIncrementTranslator extends IncrementTranslator {
|
public final class OverloadedIncrementTranslator extends IncrementTranslator {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import static org.jetbrains.k2js.translate.utils.TranslationUtils.*;
|
|||||||
/**
|
/**
|
||||||
* @author Pavel Talanov
|
* @author Pavel Talanov
|
||||||
*/
|
*/
|
||||||
//TODO: move translate() static methods into builder (consider!)
|
|
||||||
//TODO: write tests on calling backing fields as functions
|
//TODO: write tests on calling backing fields as functions
|
||||||
public final class CallTranslator extends AbstractTranslator {
|
public final class CallTranslator extends AbstractTranslator {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user