Search in sources :

Example 1 with AnnotationTerm

use of org.eclipse.ceylon.compiler.java.codegen.AnnotationTerm in project ceylon by eclipse.

the class AnnotationLoader method loadAnnotationArgumentTerm.

private AnnotationTerm loadAnnotationArgumentTerm(List<AnnotationFieldName> path, LazyFunction method, AnnotationInvocation ai, Parameter parameter, List<AnnotationMirror> annotationTree, AnnotatedMirror dpm, short code) {
    if (code < 0 && code != Short.MIN_VALUE) {
        AnnotationMirror i = annotationTree.get(-code);
        AnnotationInvocation nested = new AnnotationInvocation();
        setPrimaryFromAnnotationInvocationAnnotation(i, nested);
        loadAnnotationInvocationArguments(path, method, nested, i, annotationTree, dpm);
        InvocationAnnotationTerm term = new InvocationAnnotationTerm();
        term.setInstantiation(nested);
        return term;
    } else {
        AnnotationTerm term = decode(ModelUtil.getModuleContainer(method), method.getFirstParameterList().getParameters(), ai, parameter, dpm, path, code);
        return term;
    }
}
Also used : AnnotationMirror(org.eclipse.ceylon.model.loader.mirror.AnnotationMirror) AnnotationInvocation(org.eclipse.ceylon.compiler.java.codegen.AnnotationInvocation) InvocationAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.InvocationAnnotationTerm) CollectionLiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.CollectionLiteralAnnotationTerm) FloatLiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.FloatLiteralAnnotationTerm) ObjectLiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.ObjectLiteralAnnotationTerm) LiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.LiteralAnnotationTerm) DeclarationLiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.DeclarationLiteralAnnotationTerm) BooleanLiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.BooleanLiteralAnnotationTerm) InvocationAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.InvocationAnnotationTerm) AnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.AnnotationTerm) CharacterLiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.CharacterLiteralAnnotationTerm) ParameterAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.ParameterAnnotationTerm) IntegerLiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.IntegerLiteralAnnotationTerm) StringLiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.StringLiteralAnnotationTerm)

Example 2 with AnnotationTerm

use of org.eclipse.ceylon.compiler.java.codegen.AnnotationTerm in project ceylon by eclipse.

the class AnnotationLoader method decode.

private AnnotationTerm decode(Module moduleScope, List<Parameter> sourceParameters, AnnotationInvocation info, Parameter parameter, AnnotatedMirror dpm, List<AnnotationFieldName> path, int code) {
    AnnotationTerm result;
    if (code == Short.MIN_VALUE) {
        return findLiteralAnnotationTerm(moduleScope, path, parameter, dpm);
    } else if (code < 0) {
        InvocationAnnotationTerm invocation = new InvocationAnnotationTerm();
        result = invocation;
    } else if (code >= 0 && code < 512) {
        ParameterAnnotationTerm parameterArgument = new ParameterAnnotationTerm();
        boolean spread = false;
        if (code >= 256) {
            spread = true;
            code -= 256;
        }
        parameterArgument.setSpread(spread);
        Parameter sourceParameter = sourceParameters.get(code);
        parameterArgument.setSourceParameter(sourceParameter);
        // result.setTargetParameter(sourceParameter);
        result = parameterArgument;
    } else {
        throw new RuntimeException();
    }
    return result;
}
Also used : ParameterAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.ParameterAnnotationTerm) AnnotationConstructorParameter(org.eclipse.ceylon.compiler.java.codegen.AnnotationConstructorParameter) Parameter(org.eclipse.ceylon.model.typechecker.model.Parameter) InvocationAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.InvocationAnnotationTerm) CollectionLiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.CollectionLiteralAnnotationTerm) FloatLiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.FloatLiteralAnnotationTerm) ObjectLiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.ObjectLiteralAnnotationTerm) LiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.LiteralAnnotationTerm) DeclarationLiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.DeclarationLiteralAnnotationTerm) BooleanLiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.BooleanLiteralAnnotationTerm) InvocationAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.InvocationAnnotationTerm) AnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.AnnotationTerm) CharacterLiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.CharacterLiteralAnnotationTerm) ParameterAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.ParameterAnnotationTerm) IntegerLiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.IntegerLiteralAnnotationTerm) StringLiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.StringLiteralAnnotationTerm)

Aggregations

AnnotationTerm (org.eclipse.ceylon.compiler.java.codegen.AnnotationTerm)2 BooleanLiteralAnnotationTerm (org.eclipse.ceylon.compiler.java.codegen.BooleanLiteralAnnotationTerm)2 CharacterLiteralAnnotationTerm (org.eclipse.ceylon.compiler.java.codegen.CharacterLiteralAnnotationTerm)2 CollectionLiteralAnnotationTerm (org.eclipse.ceylon.compiler.java.codegen.CollectionLiteralAnnotationTerm)2 DeclarationLiteralAnnotationTerm (org.eclipse.ceylon.compiler.java.codegen.DeclarationLiteralAnnotationTerm)2 FloatLiteralAnnotationTerm (org.eclipse.ceylon.compiler.java.codegen.FloatLiteralAnnotationTerm)2 IntegerLiteralAnnotationTerm (org.eclipse.ceylon.compiler.java.codegen.IntegerLiteralAnnotationTerm)2 InvocationAnnotationTerm (org.eclipse.ceylon.compiler.java.codegen.InvocationAnnotationTerm)2 LiteralAnnotationTerm (org.eclipse.ceylon.compiler.java.codegen.LiteralAnnotationTerm)2 ObjectLiteralAnnotationTerm (org.eclipse.ceylon.compiler.java.codegen.ObjectLiteralAnnotationTerm)2 ParameterAnnotationTerm (org.eclipse.ceylon.compiler.java.codegen.ParameterAnnotationTerm)2 StringLiteralAnnotationTerm (org.eclipse.ceylon.compiler.java.codegen.StringLiteralAnnotationTerm)2 AnnotationConstructorParameter (org.eclipse.ceylon.compiler.java.codegen.AnnotationConstructorParameter)1 AnnotationInvocation (org.eclipse.ceylon.compiler.java.codegen.AnnotationInvocation)1 AnnotationMirror (org.eclipse.ceylon.model.loader.mirror.AnnotationMirror)1 Parameter (org.eclipse.ceylon.model.typechecker.model.Parameter)1