replace this. by $ for fields inside anonymous initializers

This commit is contained in:
Sergey Ignatov
2011-11-14 15:41:47 +04:00
parent 251b69eab3
commit 26b96d9562
13 changed files with 14 additions and 24 deletions
+2 -2
View File
@@ -62,7 +62,7 @@ public class Converter {
List<Statement> result = new LinkedList<Statement>();
for (Field f : fields) {
final String identifierToKotlin = f.getIdentifier().toKotlin();
result.add(new DummyStringStatement("this." + identifierToKotlin + " = " + identifierToKotlin));
result.add(new DummyStringStatement("$" + identifierToKotlin + " = " + identifierToKotlin));
}
return result;
}
@@ -87,7 +87,7 @@ public class Converter {
final IdentifierImpl name = new IdentifierImpl(psiClass.getName());
// we create primary constructor
if (!psiClass.isEnum() && getPrimaryConstructor(psiClass) == null) {
if (!psiClass.isEnum() && !psiClass.isInterface() && getPrimaryConstructor(psiClass) == null) {
final List<Field> finalOrWithEmptyInitializer = getFinalOrWithEmptyInitializer(fields);
final Map<String, String> initializers = new HashMap<String, String>();
@@ -3,7 +3,7 @@ class object {
val ourOut : PrintStream?
}
{
this.ourOut = ourOut
$ourOut = ourOut
}
}
open class User() {
@@ -1,7 +1,7 @@
open class Library(myString : String?) {
public val myString : String?
{
this.myString = myString
$myString = myString
}
}
open class User() {
@@ -3,7 +3,7 @@ var a : String?
var b : String?
var c : String? = "abc"
{
this.a = a
this.b = b
$a = a
$b = b
}
}
+2 -2
View File
@@ -22,8 +22,8 @@ open public fun getName() : String? {
return myName
}
{
this.myName = myName
this.myHasDollar = myHasDollar
$myName = myName
$myHasDollar = myHasDollar
}
}
public open class User() {
+1 -1
View File
@@ -1,6 +1,6 @@
open class C(f : Foo?) {
var f : Foo?
{
this.f = f
$f = f
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
open class C(f : Foo?) {
private var f : Foo?
{
this.f = f
$f = f
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
open class C(f : Foo?) {
protected var f : Foo?
{
this.f = f
$f = f
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
open class C(f : Foo?) {
public var f : Foo?
{
this.f = f
$f = f
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
open class C(f : Foo?) {
val f : Foo? = Foo(1, 2)
{
this.f = f
$f = f
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
open class C(f : Foo?) {
var f : Foo?
{
this.f = f
$f = f
}
}
@@ -4,9 +4,4 @@ val IN : String? = "in"
val AT : String? = "@"
val COMMA_WITH_SPACE : String? = (COMMA + SPACE)
}
{
this.IN = IN
this.AT = AT
this.COMMA_WITH_SPACE = COMMA_WITH_SPACE
}
}
@@ -4,9 +4,4 @@ public val IN : String? = "in"
public val AT : String? = "@"
public val COMMA_WITH_SPACE : String? = (COMMA + SPACE)
}
{
this.IN = IN
this.AT = AT
this.COMMA_WITH_SPACE = COMMA_WITH_SPACE
}
}