Search in sources :

Example 1 with LocalVariableInfo

use of com.axellience.vuegwt.processors.component.template.parser.variable.LocalVariableInfo in project vue-gwt by Axellience.

the class TemplateParser method processNameExpression.

/**
 * Process a name expression to determine if it exists in the context.
 * If it does, and it's a local variable (from a v-for) we add it to our parameters
 * @param expression The currently processed expression
 * @param nameExpr The variable we are processing
 * @param parameters The parameters this expression depends on
 */
private void processNameExpression(Expression expression, NameExpr nameExpr, List<VariableInfo> parameters) {
    String name = nameExpr.getNameAsString();
    if (context.hasImport(name)) {
        // This is a direct Class reference, we just replace with the fully qualified name
        nameExpr.setName(context.getFullyQualifiedNameForClassName(name));
        return;
    }
    VariableInfo variableInfo = context.findVariable(name);
    if (variableInfo == null) {
        logger.error("Couldn't find variable/method \"" + name + "\". Make sure you didn't forget the @JsProperty/@JsMethod annotation.");
    }
    if (variableInfo instanceof LocalVariableInfo) {
        parameters.add(variableInfo);
    }
}
Also used : LocalVariableInfo(com.axellience.vuegwt.processors.component.template.parser.variable.LocalVariableInfo) VariableInfo(com.axellience.vuegwt.processors.component.template.parser.variable.VariableInfo) LocalVariableInfo(com.axellience.vuegwt.processors.component.template.parser.variable.LocalVariableInfo)

Aggregations

LocalVariableInfo (com.axellience.vuegwt.processors.component.template.parser.variable.LocalVariableInfo)1 VariableInfo (com.axellience.vuegwt.processors.component.template.parser.variable.VariableInfo)1