// += -= public override int VisitExpPlusMinusEquals(YarnSpinnerParser.ExpPlusMinusEqualsContext context) { // call the helper to deal with this opEquals(context.variable().GetText(), context.expression(), context.op.Type); return(0); }
public override Yarn.Type VisitExpPlusMinusEquals(YarnSpinnerParser.ExpPlusMinusEqualsContext context) { ParserRuleContext[] terms = { context.variable(), context.expression() }; switch (context.op.Text) { case "+=": // + supports strings and numbers return(CheckOperation(context, terms, context.op.Text, Yarn.Type.String, Yarn.Type.Number)); case "-=": // - supports only numbers return(CheckOperation(context, terms, context.op.Text, Yarn.Type.Number)); default: throw new InvalidOperationException($"Internal error: {nameof(VisitExpMultDivMod)} got unexpected op {context.op.Text}"); } }