public override object VisitSignedFactor([NotNull] SLangGrammarParser.SignedFactorContext context) { var exprRes = (Visit(context.factor()) as ExpressionResult); if (exprRes != null) { var type = exprRes.Type; var signToken = context.AddOp() ?? context.SubOp(); if (signToken != null) { if (type is SlangSimpleType t && (t.Equals(SlangSimpleType.Real) || t.Equals(SlangSimpleType.Int))) { return(new ExpressionResult(type, ExpressionValueType.Value)); } ThrowInvalidTypesForUnaryOperationException(signToken, file, type); } else { return(new ExpressionResult(type, exprRes.ExpressionType)); } } return(null); }
public override object VisitSignedFactor([NotNull] SLangGrammarParser.SignedFactorContext context) { var op = context.AddOp() ?? context.SubOp(); if (op != null) { cppText.Write(op.GetText()); } Visit(context.factor()); return(null); }