execute method
Executes the statement within the given ctx and returns the result as a JinjaValue.
Implementation
@override
JinjaValue execute(Context ctx) {
final arg = argument.execute(ctx);
if (op.value == 'not') return JinjaBoolean(!arg.asBool);
if (op.value == '-') {
if (arg is JinjaInteger) return JinjaInteger(-arg.value);
if (arg is JinjaFloat) return JinjaFloat(-arg.value);
throw Exception('Unary - expects numeric');
}
if (op.value == '+') {
if (arg.isNumeric) return arg;
throw Exception('Unary + expects numeric');
}
throw Exception('Unknown unary op ${op.value}');
}