use of com.google.template.soy.basetree.SyntaxVersionUpperBound in project closure-templates by google.
the class ReportSyntaxVersionErrors method visitNode.
private void visitNode(TemplateNode template, Node node) {
if (!node.couldHaveSyntaxVersionAtLeast(requiredSyntaxVersion)) {
SyntaxVersionUpperBound syntaxVersionBound = node.getSyntaxVersionUpperBound();
Preconditions.checkNotNull(syntaxVersionBound);
errorReporter.report(node.getSourceLocation(), errorKind, requiredSyntaxVersion, syntaxVersionBound.reasonStr);
}
if (node instanceof FunctionNode) {
String functionName = ((FunctionNode) node).getFunctionName();
if (functionName.equals(BuiltinFunction.V1_EXPRESSION.getName()) && template.couldHaveSyntaxVersionAtLeast(SyntaxVersion.V2_0)) {
errorReporter.report(node.getSourceLocation(), errorKind, requiredSyntaxVersion, "The v1Expression function can only be used in templates marked with the " + "deprecatedV1=\"true\" attribute.");
}
}
}
use of com.google.template.soy.basetree.SyntaxVersionUpperBound in project closure-templates by google.
the class TemplateNodeBuilder method markDeprecatedV1.
// -----------------------------------------------------------------------------------------------
// Protected helpers for fields that need extra logic when being set.
protected final void markDeprecatedV1(boolean isDeprecatedV1) {
isMarkedV1 = isDeprecatedV1;
if (isDeprecatedV1) {
SyntaxVersionUpperBound newSyntaxVersionBound = new SyntaxVersionUpperBound(SyntaxVersion.V2_0, "Template is marked as deprecatedV1.");
this.syntaxVersionBound = SyntaxVersionUpperBound.selectLower(this.syntaxVersionBound, newSyntaxVersionBound);
}
}
Aggregations