visitUnaryPrefixExpr method

  1. @override
void visitUnaryPrefixExpr(
  1. UnaryPrefixExpr node
)
override

-e, !e,++e, --e

Implementation

@override
void visitUnaryPrefixExpr(UnaryPrefixExpr node) {
  node.subAccept(this);
  if (node.op == _lexicon.logicalNot && node.object.isConstValue) {
    node.value = !node.object.value;
  } else if (node.op == _lexicon.negative &&
      node.object is ASTLiteralInteger) {
    node.value = -(node.object as ASTLiteralInteger).value;
  }
}