Search in sources :

Example 1 with CompilerError

use of net.jangaroo.jooc.CompilerError in project jangaroo-tools by CoreMedia.

the class AnnotationParameter method analyze.

public void analyze(AstNode parentNode) {
    super.analyze(parentNode);
    if (getValue() != null) {
        getValue().analyze(this);
        String metaName = parentAnnotation.getMetaName();
        if ("Embed".equals(metaName) && getOptName() != null && "source".equals(getOptName().getName())) {
            JooSymbol valueSymbol = getValue().getSymbol();
            if (valueSymbol.sym != sym.STRING_LITERAL) {
                throw new CompilerError(valueSymbol, "The source parameter of an [Embed] annotation must be a string literal");
            }
            String text = valueSymbol.getText();
            String quote = text.substring(0, 1);
            String source = (String) valueSymbol.getJooValue();
            String absoluteSource = compilationUnit.addResourceDependency(source);
            getValue().setValue(new JooSymbol(valueSymbol.sym, valueSymbol.getFileName(), valueSymbol.getLine(), valueSymbol.getColumn(), valueSymbol.getWhitespace(), quote + absoluteSource + quote, absoluteSource));
        }
    }
}
Also used : CompilerError(net.jangaroo.jooc.CompilerError) JooSymbol(net.jangaroo.jooc.JooSymbol)

Aggregations

CompilerError (net.jangaroo.jooc.CompilerError)1 JooSymbol (net.jangaroo.jooc.JooSymbol)1