org.jetbrains.kotlin.asJava.elements.LightParameter converted to Kotlin
to avoid clashes in `getMethod` with `KtLightParameter`
This commit is contained in:
@@ -14,66 +14,36 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.asJava.elements;
|
package org.jetbrains.kotlin.asJava.elements
|
||||||
|
|
||||||
import com.intellij.lang.Language;
|
import com.intellij.lang.Language
|
||||||
import com.intellij.psi.*;
|
import com.intellij.psi.*
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
// Based on com.intellij.psi.impl.light.LightParameter
|
// Based on com.intellij.psi.impl.light.LightParameter
|
||||||
public class LightParameter extends LightVariableBuilder implements PsiParameter {
|
open class LightParameter @JvmOverloads constructor(
|
||||||
public static final LightParameter[] EMPTY_ARRAY = new LightParameter[0];
|
private val myName: String,
|
||||||
|
type: PsiType,
|
||||||
|
val method: KtLightMethod,
|
||||||
|
language: Language?,
|
||||||
|
private val myVarArgs: Boolean = type is PsiEllipsisType
|
||||||
|
) : LightVariableBuilder(method.manager, myName, type, language),
|
||||||
|
PsiParameter {
|
||||||
|
override fun getDeclarationScope(): KtLightMethod = method
|
||||||
|
|
||||||
private final String myName;
|
override fun accept(visitor: PsiElementVisitor) {
|
||||||
private final KtLightMethod myDeclarationScope;
|
if (visitor is JavaElementVisitor) {
|
||||||
private final boolean myVarArgs;
|
visitor.visitParameter(this)
|
||||||
|
|
||||||
public LightParameter(@NotNull String name, @NotNull PsiType type, @NotNull KtLightMethod declarationScope, Language language) {
|
|
||||||
this(name, type, declarationScope, language, type instanceof PsiEllipsisType);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LightParameter(
|
|
||||||
@NotNull String name,
|
|
||||||
@NotNull PsiType type,
|
|
||||||
@NotNull KtLightMethod declarationScope,
|
|
||||||
Language language,
|
|
||||||
boolean isVarArgs
|
|
||||||
) {
|
|
||||||
super(declarationScope.getManager(), name, type, language);
|
|
||||||
myName = name;
|
|
||||||
myDeclarationScope = declarationScope;
|
|
||||||
myVarArgs = isVarArgs;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public KtLightMethod getDeclarationScope() {
|
|
||||||
return myDeclarationScope;
|
|
||||||
}
|
|
||||||
|
|
||||||
public KtLightMethod getMethod() {
|
|
||||||
return myDeclarationScope;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
|
||||||
if (visitor instanceof JavaElementVisitor) {
|
|
||||||
((JavaElementVisitor) visitor).visitParameter(this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
override fun toString(): String = "Light Parameter"
|
||||||
return "Light Parameter";
|
|
||||||
|
override fun isVarArgs(): Boolean = myVarArgs
|
||||||
|
|
||||||
|
override fun getName(): String = myName
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
val EMPTY_ARRAY = arrayOfNulls<LightParameter>(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isVarArgs() {
|
|
||||||
return myVarArgs;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return myName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user