public override Yarn.Type VisitExpNegative(YarnSpinnerParser.ExpNegativeContext context) { ParserRuleContext[] terms = new[] { context.expression() }; // - supports only number types return(CheckOperation(context, terms, "-", Yarn.Type.Number)); }
// -expression public override int VisitExpNegative(YarnSpinnerParser.ExpNegativeContext context) { Visit(context.expression()); // TODO: temp operator call compiler.Emit(ByteCode.CallFunc, TokenType.UnaryMinus.ToString()); return(0); }
public override Yarn.IType VisitExpNegative(YarnSpinnerParser.ExpNegativeContext context) { ParserRuleContext[] terms = new[] { context.expression() }; var @operator = CodeGenerationVisitor.TokensToOperators[context.op.Type]; Yarn.IType type = CheckOperation(context, terms, @operator, context.op.Text); context.Type = type; return(type); }
// -expression public override int VisitExpNegative(YarnSpinnerParser.ExpNegativeContext context) { Visit(context.expression()); // TODO: temp operator call // Indicate that we are pushing one parameter compiler.Emit(OpCode.PushFloat, new Operand(1)); compiler.Emit(OpCode.CallFunc, new Operand(TokenType.UnaryMinus.ToString())); return(0); }
// -expression public override int VisitExpNegative(YarnSpinnerParser.ExpNegativeContext context) { this.GenerateCodeForOperation(Operator.UnaryMinus, context.op, context.Type, context.expression()); return(0); }