Introduce kotlin.jvm.internal.Lambda, superclass for all lambdas

It has its arity precomputed, as opposed to the future KFunctionImpl inheriting
from FunctionImpl, for which the computation of arity can take some time and so
it shouldn't be passed in the constructor and saved as a field
This commit is contained in:
Alexander Udalov
2015-05-20 17:40:45 +03:00
parent 86ecb423f6
commit 27ed098467
5 changed files with 38 additions and 5 deletions
@@ -0,0 +1,23 @@
/*
* Copyright 2010-2015 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.
*/
package kotlin.jvm.internal
public abstract class Lambda(private val arity: Int) : FunctionImpl() {
override fun getArity() = arity
override fun toString() = "${(this as Object).getClass().getGenericInterfaces()[0]}"
}