intrinsic renamed to Intrinsic
This commit is contained in:
@@ -52,7 +52,7 @@ public abstract class AnnotationCodegen {
|
|||||||
|
|
||||||
if(!valueArguments.isEmpty()) {
|
if(!valueArguments.isEmpty()) {
|
||||||
// todo: temporary hack for intrinsics in stdlib
|
// todo: temporary hack for intrinsics in stdlib
|
||||||
if(valueArguments.size()==1 && "intrinsic".equals(annotationDescriptor.getType().getConstructor().getDeclarationDescriptor().getName())) {
|
if(valueArguments.size()==1 && "Intrinsic".equals(annotationDescriptor.getType().getConstructor().getDeclarationDescriptor().getName())) {
|
||||||
annotationVisitor.visit("value", valueArguments.get(0).getValue());
|
annotationVisitor.visit("value", valueArguments.get(0).getValue());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class BinaryOp implements IntrinsicMethod {
|
|||||||
expectedType = JetTypeMapper.unboxType(expectedType);
|
expectedType = JetTypeMapper.unboxType(expectedType);
|
||||||
}
|
}
|
||||||
if (arguments.size() == 1) {
|
if (arguments.size() == 1) {
|
||||||
// intrinsic is called as an ordinary function
|
// Intrinsic is called as an ordinary function
|
||||||
if (receiver != null) {
|
if (receiver != null) {
|
||||||
receiver.put(expectedType, v);
|
receiver.put(expectedType, v);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ public class IntrinsicMethods {
|
|||||||
List<AnnotationDescriptor> annotations = descriptor.getAnnotations();
|
List<AnnotationDescriptor> annotations = descriptor.getAnnotations();
|
||||||
if (annotations != null) {
|
if (annotations != null) {
|
||||||
for (AnnotationDescriptor annotation : annotations) {
|
for (AnnotationDescriptor annotation : annotations) {
|
||||||
if("intrinsic".equals(annotation.getType().getConstructor().getDeclarationDescriptor().getName())) {
|
if("Intrinsic".equals(annotation.getType().getConstructor().getDeclarationDescriptor().getName())) {
|
||||||
intrinsicMethod = namedMethods.get(annotation.getValueArguments().get(0).getValue());
|
intrinsicMethod = namedMethods.get(annotation.getValueArguments().get(0).getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-7
@@ -1315,13 +1315,6 @@ public class JavaDescriptorResolver {
|
|||||||
@Nullable
|
@Nullable
|
||||||
private FunctionDescriptorImpl resolveMethodToFunctionDescriptor(ClassOrNamespaceDescriptor owner, final PsiClass psiClass, TypeSubstitutor typeSubstitutorForGenericSuperclasses, final PsiMethodWrapper method) {
|
private FunctionDescriptorImpl resolveMethodToFunctionDescriptor(ClassOrNamespaceDescriptor owner, final PsiClass psiClass, TypeSubstitutor typeSubstitutorForGenericSuperclasses, final PsiMethodWrapper method) {
|
||||||
|
|
||||||
PsiAnnotation[] applicableAnnotations = method.getPsiMethod().getModifierList().getAnnotations();
|
|
||||||
for (PsiAnnotation applicableAnnotation : applicableAnnotations) {
|
|
||||||
if("jet.runtime.intrinsic".equals(applicableAnnotation.getQualifiedName())) {
|
|
||||||
PsiAnnotationMemberValue value = applicableAnnotation.findAttributeValue("value");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PsiType returnType = method.getReturnType();
|
PsiType returnType = method.getReturnType();
|
||||||
if (returnType == null) {
|
if (returnType == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ public abstract class JetPsiReference implements PsiPolyVariantReference {
|
|||||||
Collection<? extends DeclarationDescriptor> declarationDescriptors = bindingContext.get(AMBIGUOUS_REFERENCE_TARGET, myExpression);
|
Collection<? extends DeclarationDescriptor> declarationDescriptors = bindingContext.get(AMBIGUOUS_REFERENCE_TARGET, myExpression);
|
||||||
if (declarationDescriptors != null) return null;
|
if (declarationDescriptors != null) return null;
|
||||||
|
|
||||||
// TODO: Need a better resolution for intrinsic function (KT-975)
|
// TODO: Need a better resolution for Intrinsic function (KT-975)
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ public abstract class JetPsiReference implements PsiPolyVariantReference {
|
|||||||
for (DeclarationDescriptor descriptor : declarationDescriptors) {
|
for (DeclarationDescriptor descriptor : declarationDescriptors) {
|
||||||
PsiElement element = bindingContext.get(DESCRIPTOR_TO_DECLARATION, descriptor);
|
PsiElement element = bindingContext.get(DESCRIPTOR_TO_DECLARATION, descriptor);
|
||||||
if (element == null) {
|
if (element == null) {
|
||||||
// TODO: Need a better resolution for intrinsic function (KT-975)
|
// TODO: Need a better resolution for Intrinsic function (KT-975)
|
||||||
element = file;
|
element = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package std
|
|||||||
import java.lang.Class
|
import java.lang.Class
|
||||||
import java.lang.Object
|
import java.lang.Object
|
||||||
|
|
||||||
import jet.runtime.intrinsic
|
import jet.runtime.Intrinsic
|
||||||
|
|
||||||
val <T> T.javaClass : Class<T>
|
val <T> T.javaClass : Class<T>
|
||||||
[intrinsic("std.javaClass.property")] get() = (this as java.lang.Object).getClass() as Class<T>
|
[Intrinsic("std.javaClass.property")] get() = (this as java.lang.Object).getClass() as Class<T>
|
||||||
|
|
||||||
[intrinsic("std.javaClass.function")] fun <T> javaClass() : Class<T> = null as Class<T>
|
[Intrinsic("std.javaClass.function")] fun <T> javaClass() : Class<T> = null as Class<T>
|
||||||
|
|||||||
@@ -26,6 +26,6 @@ import java.lang.annotation.Target;
|
|||||||
*/
|
*/
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target(ElementType.METHOD)
|
@Target(ElementType.METHOD)
|
||||||
public @interface intrinsic {
|
public @interface Intrinsic {
|
||||||
String value();
|
String value();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user