Drop inlineOptions and fix forgotten usages

This commit is contained in:
Denis Zharkov
2015-09-23 12:07:07 +03:00
parent 67486b867b
commit 098f5462eb
58 changed files with 13 additions and 150 deletions
@@ -1,22 +0,0 @@
/*
* 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 org.jetbrains.kotlin.resolve.inline;
public enum InlineOption {
LOCAL_CONTINUE_AND_BREAK,
ONLY_LOCAL_RETURN
}
@@ -61,29 +61,8 @@ public class InlineUtil {
return InlineStrategy.valueOf(((EnumValue) argument).getValue().getName().asString());
}
public static boolean hasOnlyLocalContinueAndBreak(@NotNull ValueParameterDescriptor descriptor) {
return hasInlineOption(descriptor, InlineOption.LOCAL_CONTINUE_AND_BREAK);
}
public static boolean hasOnlyLocalReturn(@NotNull ValueParameterDescriptor descriptor) {
return hasInlineOption(descriptor, InlineOption.ONLY_LOCAL_RETURN)
|| descriptor.getAnnotations().findAnnotation(KotlinBuiltIns.FQ_NAMES.crossinline) != null;
}
private static boolean hasInlineOption(@NotNull ValueParameterDescriptor descriptor, @NotNull InlineOption option) {
AnnotationDescriptor annotation = descriptor.getAnnotations().findAnnotation(KotlinBuiltIns.FQ_NAMES.inlineOptions);
if (annotation != null) {
ConstantValue<?> argument = firstOrNull(annotation.getAllValueArguments().values());
if (argument instanceof ArrayValue) {
for (ConstantValue<?> value : ((ArrayValue) argument).getValue()) {
if (value instanceof EnumValue && ((EnumValue) value).getValue().getName().asString().equals(option.name())) {
return true;
}
}
}
}
return false;
return descriptor.getAnnotations().findAnnotation(KotlinBuiltIns.FQ_NAMES.crossinline) != null;
}
public static boolean checkNonLocalReturnUsage(