this statement added
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
package org.jetbrains.jet.j2k.ast;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ignatov
|
||||||
|
*/
|
||||||
|
public class ThisExpression extends Expression {
|
||||||
|
private Identifier myIdentifier;
|
||||||
|
|
||||||
|
public ThisExpression(Identifier identifier) {
|
||||||
|
myIdentifier = identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String toKotlin() {
|
||||||
|
if (myIdentifier.isEmpty())
|
||||||
|
return "this";
|
||||||
|
return "this" + AT + myIdentifier.toKotlin();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -193,7 +193,7 @@ public class ExpressionVisitor extends StatementVisitor implements Visitor {
|
|||||||
myResult = new NewClassExpression(
|
myResult = new NewClassExpression(
|
||||||
elementToElement(expression.getClassOrAnonymousClassReference()),
|
elementToElement(expression.getClassOrAnonymousClassReference()),
|
||||||
elementToElement(expression.getArgumentList()),
|
elementToElement(expression.getArgumentList()),
|
||||||
expression.getAnonymousClass() != null?
|
expression.getAnonymousClass() != null ?
|
||||||
anonymousClassToAnonymousClass(expression.getAnonymousClass()) :
|
anonymousClassToAnonymousClass(expression.getAnonymousClass()) :
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
@@ -239,13 +239,24 @@ public class ExpressionVisitor extends StatementVisitor implements Visitor {
|
|||||||
@Override
|
@Override
|
||||||
public void visitSuperExpression(PsiSuperExpression expression) {
|
public void visitSuperExpression(PsiSuperExpression expression) {
|
||||||
super.visitSuperExpression(expression);
|
super.visitSuperExpression(expression);
|
||||||
|
final PsiJavaCodeReferenceElement qualifier = expression.getQualifier();
|
||||||
myResult = new SuperExpression(
|
myResult = new SuperExpression(
|
||||||
expression.getQualifier() != null ? new IdentifierImpl(expression.getQualifier().getQualifiedName()): Identifier.EMPTY_IDENTIFIER);
|
qualifier != null ?
|
||||||
|
new IdentifierImpl(qualifier.getQualifiedName()) :
|
||||||
|
Identifier.EMPTY_IDENTIFIER
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitThisExpression(PsiThisExpression expression) {
|
public void visitThisExpression(PsiThisExpression expression) {
|
||||||
super.visitThisExpression(expression);
|
super.visitThisExpression(expression);
|
||||||
|
final PsiJavaCodeReferenceElement qualifier = expression.getQualifier();
|
||||||
|
myResult = new ThisExpression(
|
||||||
|
qualifier != null ?
|
||||||
|
new IdentifierImpl(qualifier.getQualifiedName()) :
|
||||||
|
Identifier.EMPTY_IDENTIFIER
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
class Base {
|
||||||
|
void foo() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
class A extends Base {
|
||||||
|
class C {
|
||||||
|
void test() {
|
||||||
|
A.this.foo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
namespace {
|
||||||
|
open class Base {
|
||||||
|
fun foo() : Unit {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
open class A : Base {
|
||||||
|
open class C {
|
||||||
|
fun test() : Unit {
|
||||||
|
this@A.foo()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
super.call();
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
super.call()
|
||||||
Reference in New Issue
Block a user