Skip to content

Commit f74c095

Browse files
cypressious4u7
authored andcommitted
use property syntax
1 parent 384b641 commit f74c095

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

compiler/frontend/src/org/jetbrains/kotlin/psi/KtClass.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2016 JetBrains s.r.o.
2+
* Copyright 2010-2017 JetBrains s.r.o.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -89,7 +89,7 @@ open class KtClass : KtClassOrObject {
8989
}
9090

9191
fun KtClass.createPrimaryConstructorIfAbsent(): KtPrimaryConstructor {
92-
val constructor = getPrimaryConstructor()
92+
val constructor = primaryConstructor
9393
if (constructor != null) return constructor
9494
var anchor: PsiElement? = typeParameterList
9595
if (anchor == null) anchor = nameIdentifier

compiler/frontend/src/org/jetbrains/kotlin/psi/KtPsiFactory.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2016 JetBrains s.r.o.
2+
* Copyright 2010-2017 JetBrains s.r.o.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -181,7 +181,7 @@ class KtPsiFactory(private val project: Project) {
181181
}
182182

183183
fun createCompanionObject(): KtObjectDeclaration {
184-
return createClass("class A {\n companion object{\n}\n}").getCompanionObjects().first()
184+
return createClass("class A {\n companion object{\n}\n}").companionObjects.first()
185185
}
186186

187187
fun createFileAnnotation(annotationText: String): KtAnnotationEntry {
@@ -293,7 +293,7 @@ class KtPsiFactory(private val project: Project) {
293293
fun createCallableReferenceExpression(text: String) = createExpression(text) as? KtCallableReferenceExpression
294294

295295
fun createSecondaryConstructor(decl: String): KtSecondaryConstructor {
296-
return createClass("class Foo {\n $decl \n}").getSecondaryConstructors().first()
296+
return createClass("class Foo {\n $decl \n}").secondaryConstructors.first()
297297
}
298298

299299
fun createModifierList(modifier: KtModifierKeywordToken): KtModifierList {
@@ -326,7 +326,7 @@ class KtPsiFactory(private val project: Project) {
326326
}
327327

328328
fun createParameter(text : String): KtParameter {
329-
return createClass("class A($text)").getPrimaryConstructorParameters().first()
329+
return createClass("class A($text)").primaryConstructorParameters.first()
330330
}
331331

332332
fun createParameterList(text: String): KtParameterList {
@@ -401,15 +401,15 @@ class KtPsiFactory(private val project: Project) {
401401
}
402402

403403
fun createPrimaryConstructor(): KtPrimaryConstructor {
404-
return createClass("class A()").getPrimaryConstructor()!!
404+
return createClass("class A()").primaryConstructor!!
405405
}
406406

407407
fun createPrimaryConstructor(modifiers: String?): KtPrimaryConstructor {
408-
return modifiers?.let { createClass("class A $modifiers constructor()").getPrimaryConstructor() } ?: createPrimaryConstructor()
408+
return modifiers?.let { createClass("class A $modifiers constructor()").primaryConstructor } ?: createPrimaryConstructor()
409409
}
410410

411411
fun createConstructorKeyword(): PsiElement =
412-
createClass("class A constructor()").getPrimaryConstructor()!!.getConstructorKeyword()!!
412+
createClass("class A constructor()").primaryConstructor!!.getConstructorKeyword()!!
413413

414414
fun createLabeledExpression(labelName: String): KtLabeledExpression
415415
= createExpression("$labelName@ 1") as KtLabeledExpression
@@ -456,16 +456,16 @@ class KtPsiFactory(private val project: Project) {
456456
fun createArgument(text: String) = createCallArguments("($text)").arguments.first()!!
457457

458458
fun createSuperTypeCallEntry(text: String): KtSuperTypeCallEntry {
459-
return createClass("class A: $text").getSuperTypeListEntries().first() as KtSuperTypeCallEntry
459+
return createClass("class A: $text").superTypeListEntries.first() as KtSuperTypeCallEntry
460460
}
461461

462462
fun createSuperTypeEntry(text: String): KtSuperTypeEntry {
463-
return createClass("class A: $text").getSuperTypeListEntries().first() as KtSuperTypeEntry
463+
return createClass("class A: $text").superTypeListEntries.first() as KtSuperTypeEntry
464464
}
465465

466466
fun creareDelegatedSuperTypeEntry(text: String): KtConstructorDelegationCall {
467467
val colonOrEmpty = if (text.isEmpty()) "" else ": "
468-
return createClass("class A { constructor()$colonOrEmpty$text {}").getSecondaryConstructors().first().getDelegationCall()
468+
return createClass("class A { constructor()$colonOrEmpty$text {}").secondaryConstructors.first().getDelegationCall()
469469
}
470470

471471
class ClassHeaderBuilder {

0 commit comments

Comments
 (0)