/// <summary> /// Finds the matching nodes of a <see cref="IUnaryNotExpression"/>. /// </summary> /// <param name="node">The agent expression to check.</param> /// <param name="errorList">The list of errors found.</param> /// <param name="resolvedResult">The expression result types upon return.</param> /// <param name="resolvedException">Exceptions the expression can throw upon return.</param> /// <param name="constantSourceList">Sources of the constant expression upon return, if any.</param> /// <param name="expressionConstant">The constant value upon return, if any.</param> public static bool ResolveCompilerReferences(IUnaryNotExpression node, IErrorList errorList, out IResultType resolvedResult, out IResultException resolvedException, out ISealableList <IExpression> constantSourceList, out ILanguageConstant expressionConstant) { resolvedResult = null; resolvedException = null; constantSourceList = new SealableList <IExpression>(); expressionConstant = NeutralLanguageConstant.NotConstant; IExpression RightExpression = (IExpression)node.RightExpression; IClass EmbeddingClass = node.EmbeddingClass; bool IsRightClassType = Expression.GetClassTypeOfExpression(RightExpression, errorList, out IClassType RightExpressionClassType); if (!IsRightClassType) { return(false); } Expression.IsLanguageTypeAvailable(LanguageClasses.Boolean.Guid, node, out ITypeName BooleanTypeName, out ICompiledType BooleanType); Expression.IsLanguageTypeAvailable(LanguageClasses.Event.Guid, node, out ITypeName EventTypeName, out ICompiledType EventType); Debug.Assert(RightExpressionClassType == BooleanType || RightExpressionClassType == EventType); node.SetIsEventExpression(RightExpressionClassType != BooleanType); constantSourceList.Add(RightExpression); resolvedResult = new ResultType(BooleanTypeName, BooleanType, string.Empty); ResultException.Propagate(RightExpression.ResolvedException, out resolvedException); #if COVERAGE Debug.Assert(node.IsComplex); #endif return(true); }
/// <summary> /// Compares two expressions. /// </summary> /// <param name="other">The other expression.</param> protected bool IsExpressionEqual(IUnaryNotExpression other) { Debug.Assert(other != null); bool Result = true; Result &= Expression.IsExpressionEqual((IExpression)RightExpression, (IExpression)other.RightExpression); return(Result); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpUnaryNotExpression"/> class. /// </summary> /// <param name="context">The creation context.</param> /// <param name="source">The Easly expression from which the C# expression is created.</param> protected CSharpUnaryNotExpression(ICSharpContext context, IUnaryNotExpression source) : base(context, source) { RightExpression = Create(context, (IExpression)source.RightExpression); }
/// <summary> /// Creates a new C# expression. /// </summary> /// <param name="context">The creation context.</param> /// <param name="source">The Easly expression from which the C# expression is created.</param> public static ICSharpUnaryNotExpression Create(ICSharpContext context, IUnaryNotExpression source) { return(new CSharpUnaryNotExpression(context, source)); }