public override void CheckSemantic(Scope scope, ErrorLog log) { Condition.CheckSemantic(scope, log); if (!Condition.Type.Match(ShaderRuntime.Boolean)) { log.Error("The condition is not or cant be converted to bool", Line, Column); } OnTrue.CheckSemantic(scope, log); OnFalse.CheckSemantic(scope, log); Type = OnTrue.Type; }
public override void CheckSemantic(IASTContext context) { Condition.CheckSemantic(context); if (Condition.Type != ExpressionType.Bool) { throw new RecognitionException($"Expression at Line {Row} Col {Col} does not return boolean value"); } OnTrue.CheckSemantic(context); OnFalse.CheckSemantic(context); type = ExpressionType.match(OnTrue.Type, OnFalse.Type); if (type == null) { throw new RecognitionException("Type mistmatch ", Col, Row); } NetType = OnTrue.NetType; }