evalUnaryExpression method
dynamic
evalUnaryExpression()
inherited
Implementation
@protected
dynamic evalUnaryExpression(
UnaryExpression expression,
Map<String, dynamic> context,
) {
final argument = eval(expression.argument, context);
dynamic result;
switch (expression.operator) {
case '-':
result = -argument;
break;
case '+':
result = argument;
break;
case '!':
result = !argument;
break;
case '~':
result = ~argument;
break;
default:
throw ArgumentError('Unknown unary operator ${expression.operator}');
}
return result;
}