From dca6f89768df5a6e7f99257611703d70ea511a37 Mon Sep 17 00:00:00 2001 From: Daniil Ovchinnikov Date: Wed, 8 Nov 2017 21:22:21 +0300 Subject: [PATCH] [jvm-lang] add couple helper functions --- .../lang/jvm/actions/expectedTypes.kt | 22 ++++--------------- .../intellij/lang/jvm/actions/parameters.kt | 2 ++ 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/java/java-analysis-api/src/com/intellij/lang/jvm/actions/expectedTypes.kt b/java/java-analysis-api/src/com/intellij/lang/jvm/actions/expectedTypes.kt index 327e9a8edc29..591858d2c837 100644 --- a/java/java-analysis-api/src/com/intellij/lang/jvm/actions/expectedTypes.kt +++ b/java/java-analysis-api/src/com/intellij/lang/jvm/actions/expectedTypes.kt @@ -1,27 +1,13 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.lang.jvm.actions import com.intellij.lang.jvm.types.JvmType typealias ExpectedTypes = List -fun expectedType(type: JvmType, kind: ExpectedType.Kind = ExpectedType.Kind.EXACT): ExpectedType { - return SimpleExpectedType(type, kind) -} +fun expectedType(type: JvmType, kind: ExpectedType.Kind = ExpectedType.Kind.EXACT): ExpectedType = SimpleExpectedType(type, kind) + +fun expectedTypes(type: JvmType): ExpectedTypes = listOf(expectedType(type)) private class SimpleExpectedType( override val theType: JvmType, diff --git a/java/java-analysis-api/src/com/intellij/lang/jvm/actions/parameters.kt b/java/java-analysis-api/src/com/intellij/lang/jvm/actions/parameters.kt index 32b72cf86a73..78d368eeb5fd 100644 --- a/java/java-analysis-api/src/com/intellij/lang/jvm/actions/parameters.kt +++ b/java/java-analysis-api/src/com/intellij/lang/jvm/actions/parameters.kt @@ -5,3 +5,5 @@ import com.intellij.psi.codeStyle.SuggestedNameInfo typealias ExpectedParameter = Pair typealias ExpectedParameters = List + +fun nameInfo(vararg names: String): SuggestedNameInfo = object : SuggestedNameInfo(names) {}