/// <summary> /// This property signs if an expression is ready to be evaluated, /// namely, all subexpression values are known /// </summary> /// <param name="evalContext">Evaluation context</param> /// <returns>True, if the expression is ready; otherwise, false</returns> public override bool ReadyToEvaluate(IEvaluationContext evalContext) { var result = evalContext.GetSymbolValue(SymbolName, ScopeSymbolNames, StartFromGlobal).ExprValue != null; if (!result) { AddError(FullSymbolName); } return(result); }
/// <summary> /// Retrieves the value of the expression /// </summary> /// <param name="evalContext">Evaluation context</param> /// <returns>Evaluated expression value</returns> public override ExpressionValue Evaluate(IEvaluationContext evalContext) { var(exprValue, usageInfo) = evalContext.GetSymbolValue(SymbolName, ScopeSymbolNames, StartFromGlobal); if (exprValue != null) { if (usageInfo != null) { usageInfo.IsUsed = true; } return(exprValue); } AddError(FullSymbolName); return(ExpressionValue.NonEvaluated); }
/// <summary> /// Retrieves the value of the expression /// </summary> /// <param name="evalContext">Evaluation context</param> /// <returns>Evaluated expression value</returns> public override ExpressionValue Evaluate(IEvaluationContext evalContext) { var idExpr = evalContext.GetSymbolValue(MacroParamId).ExprValue; return(idExpr ?? ExpressionValue.NonEvaluated); }
/// <summary> /// This property signs if an expression is ready to be evaluated, /// namely, all subexpression values are known /// </summary> /// <param name="evalContext">Evaluation context</param> /// <returns>True, if the expression is ready; otherwise, false</returns> public override bool ReadyToEvaluate(IEvaluationContext evalContext) => evalContext.GetSymbolValue(MacroParamId).ExprValue != null;
/// <summary> /// Retrieves the value of the expression /// </summary> /// <param name="evalContext">Evaluation context</param> /// <returns>Evaluated expression value</returns> public override ushort Evaluate(IEvaluationContext evalContext) { return(evalContext.GetSymbolValue(SymbolName) ?? 0); }
/// <summary> /// This property signs if an expression is ready to be evaluated, /// namely, all subexpression values are known /// </summary> /// <param name="evalContext">Evaluation context</param> /// <returns>True, if the expression is ready; otherwise, false</returns> public override bool ReadyToEvaluate(IEvaluationContext evalContext) => evalContext.GetSymbolValue(SymbolName) != null;