public virtual void VisitNewExpression <TTypeReference, TArgument>( INewExpression <TTypeReference, TArgument> newExpression) where TTypeReference : ITypeReference where TArgument : IArgument { Visit(newExpression); }
public static void VisitNewExpressionChildren<TTypeReference, TArgument>( INewExpression<TTypeReference, TArgument> newExpression, IGenericExpressionVisitor visitor) where TTypeReference : ITypeReference where TArgument : IArgument { VisitCollection(newExpression.Parameters, visitor); }
public override void VisitNewExpression <TTypeReference, TExpression>( INewExpression <TTypeReference, TExpression> newExpression) { Value = new Expression() { NewExpression = new NewExpressionFactory(newExpression).Value }; }
public override void VisitNewExpression <TTypeReference, TExpression>( INewExpression <TTypeReference, TExpression> newExpression) { Steps.Add(new WriteNewKeyword()); Steps.Add(new WriteWhitespace()); Steps.Add(new WriteChildNode <TTypeReference>(newExpression.Type)); Steps.Add(new WriteStartParenthesis()); Steps.AddCommaSeparatedExpressionSteps(newExpression.Parameters); Steps.Add(new WriteEndParenthesis()); }
/// <summary> /// Compares two expressions. /// </summary> /// <param name="other">The other expression.</param> protected bool IsExpressionEqual(INewExpression other) { Debug.Assert(other != null); bool Result = true; Result &= QualifiedName.IsQualifiedNameEqual((IQualifiedName)Object, (IQualifiedName)other.Object); return(Result); }
/// <summary> /// Finds the matching nodes of a <see cref="INewExpression"/>. /// </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 expression constant upon return.</param> /// <param name="resolvedFinalFeature">The matching feature upon return.</param> public static bool ResolveCompilerReferences(INewExpression node, IErrorList errorList, out IResultType resolvedResult, out IResultException resolvedException, out ISealableList <IExpression> constantSourceList, out ILanguageConstant expressionConstant, out ICompiledFeature resolvedFinalFeature) { resolvedResult = null; resolvedException = null; constantSourceList = new SealableList <IExpression>(); expressionConstant = NeutralLanguageConstant.NotConstant; resolvedFinalFeature = null; IClass EmbeddingClass = node.EmbeddingClass; IQualifiedName Object = (IQualifiedName)node.Object; IList <IIdentifier> ValidPath = Object.ValidPath.Item; IClassType BaseType = EmbeddingClass.ResolvedClassType.Item; if (!Expression.IsLanguageTypeAvailable(LanguageClasses.Boolean.Guid, node, out ITypeName BooleanTypeName, out ICompiledType BooleanType)) { errorList.AddError(new ErrorBooleanTypeMissing(node)); return(false); } ISealableDictionary <string, IScopeAttributeFeature> LocalScope = Scope.CurrentScope(node); if (!ObjectType.GetQualifiedPathFinalType(EmbeddingClass, BaseType, LocalScope, ValidPath, 0, errorList, out ICompiledFeature FinalFeature, out IDiscrete FinalDiscrete, out ITypeName FinalTypeName, out ICompiledType FinalType, out bool InheritBySideAttribute)) { return(false); } if (FinalFeature == null) { errorList.AddError(new ErrorConstantNewExpression(node)); return(false); } ObjectType.FillResultPath(EmbeddingClass, BaseType, LocalScope, ValidPath, 0, Object.ValidResultTypePath.Item); resolvedResult = new ResultType(BooleanTypeName, BooleanType, string.Empty); resolvedException = new ResultException(); resolvedFinalFeature = FinalFeature; #if COVERAGE Debug.Assert(!node.IsComplex); #endif return(true); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpNewExpression"/> class. /// </summary> /// <param name="context">The creation context.</param> /// <param name="source">The Easly expression from which the C# expression is created.</param> protected CSharpNewExpression(ICSharpContext context, INewExpression source) : base(context, source) { }
/// <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 ICSharpNewExpression Create(ICSharpContext context, INewExpression source) { return(new CSharpNewExpression(context, source)); }