[jvm-lang] add couple helper functions

This commit is contained in:
Daniil Ovchinnikov
2017-11-09 18:52:51 +03:00
parent 243e4d078e
commit dca6f89768
2 changed files with 6 additions and 18 deletions
@@ -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<ExpectedType>
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,
@@ -5,3 +5,5 @@ import com.intellij.psi.codeStyle.SuggestedNameInfo
typealias ExpectedParameter = Pair<SuggestedNameInfo, ExpectedTypes>
typealias ExpectedParameters = List<ExpectedParameter>
fun nameInfo(vararg names: String): SuggestedNameInfo = object : SuggestedNameInfo(names) {}