Esempio n. 1
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)
        {
            var result = evalContext.GetSymbolValue(SymbolName, ScopeSymbolNames, StartFromGlobal).ExprValue != null;

            if (!result)
            {
                AddError(FullSymbolName);
            }
            return(result);
        }
Esempio n. 2
0
 /// <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);
 }
Esempio n. 3
0
        /// <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);
        }
Esempio n. 4
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(MacroParamId).ExprValue != null;
Esempio n. 5
0
 /// <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);
 }
Esempio n. 6
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;