private VariableDeclaration(EntityModifier modifier, ExpressionReadMode readMode, string name, INameReference typeName, IExpression initValue, IEnumerable <LabelReference> friends = null) : base(readMode) { if (name == null) { throw new ArgumentNullException(); } this.Modifier = modifier ?? EntityModifier.None; this.Name = NameDefinition.Create(name); this.TypeName = typeName; this.initValue = initValue; this.AccessGrants = (friends ?? Enumerable.Empty <LabelReference>()).StoreReadOnly(); this.instancesCache = new EntityInstanceCache(this, () => GetInstance(TypeMutability.None, TemplateTranslation.CreateParameterless(this), Lifetime.Timeless)); this.closures = new List <TypeDefinition>(); this.attachPostConstructor(); this.flow = Later.Create(() => ExecutionFlow.CreatePath(InitValue)); }
private Spread(IExpression expr) : base(ExpressionReadMode.ReadRequired) { this.expr = expr; this.attachPostConstructor(); this.flow = Later.Create(() => ExecutionFlow.CreatePath(Expr)); }
private Chain(IEnumerable <IExpression> instructions) : base(ExpressionReadMode.ReadRequired) { this.Instructions = instructions.StoreReadOnly(); this.attachPostConstructor(); this.flow = Later.Create(() => ExecutionFlow.CreatePath(this.Instructions)); }
private ReinterpretType(IExpression lhs, INameReference rhsTypeName) : base(ExpressionReadMode.ReadRequired) { this.Lhs = lhs; this.RhsTypeName = rhsTypeName; this.attachPostConstructor(); this.flow = Later.Create(() => ExecutionFlow.CreatePath(Lhs)); }
private IsSame(IExpression lhs, IExpression rhs) : base(ExpressionReadMode.ReadRequired) { this.Lhs = lhs; this.Rhs = rhs; this.attachPostConstructor(); this.flow = Later.Create(() => ExecutionFlow.CreatePath(Lhs, Rhs)); }
private FunctionArgument(string nameLabel, IExpression expression) : base() { this.NameLabel = nameLabel; this.expression = expression; this.closures = new List <TypeDefinition>(); this.attachPostConstructor(); this.flow = Later.Create(() => ExecutionFlow.CreatePath(Expression)); }
private FunctionCall(CallMode mode, IExpression callee, IEnumerable <FunctionArgument> arguments, NameReference requestedOutcomeType) : base() { this.mode = mode; this.callee = callee; this.UserArguments = (arguments ?? Enumerable.Empty <FunctionArgument>()).Indexed().StoreReadOnlyList(); this.RequestedOutcomeTypeName = requestedOutcomeType; this.closures = new List <TypeDefinition>(); this.attachPostConstructor(); this.flow = Later.Create(() => ExecutionFlow.CreatePath(UserArguments)); }
private FunctionDefinition(EntityModifier modifier, NameDefinition name, NameDefinition label, IEnumerable <TemplateConstraint> constraints, IEnumerable <FunctionParameter> parameters, ExpressionReadMode callMode, INameReference result, FunctionCall constructorChainCall, Block body, IEnumerable <NameReference> includes, IEnumerable <LabelReference> friends) : base(modifier | (body == null ? EntityModifier.Abstract : EntityModifier.None), name, constraints, includes) { parameters = parameters ?? Enumerable.Empty <FunctionParameter>(); this.Label = label ?? NameDefinition.Create(name.Name); this.AccessGrants = (friends ?? Enumerable.Empty <LabelReference>()).StoreReadOnly(); this.Parameters = parameters.Indexed().StoreReadOnlyList(); setResultParameter(result); this.IsResultTypeNameInfered = result == null; if (this.IsResultTypeNameInfered) { this.resultTypeCandidates = new List <IEntityInstance>(); } this.UserBody = body; this.CallMode = callMode; // attaching zero-constructor call to the body of the function will be done when attaching entire function to a type if (constructorChainCall != null) { this.UserBody.SetConstructorChainCall(constructorChainCall); } if (this.IsLambdaInvoker) { this.LambdaTrap = new LambdaTrap(); } this.attachPostConstructor(); this.flow = Later.Create(() => ExecutionFlow.CreatePath(UserBody)); this.constructionCompleted = true; if (!IsValidMutableName(this.Name.Name, this.Modifier)) { throw new ArgumentException($"Mutable function has to be marked with name as well {this.Name}"); } }
protected Expression(Option <ExpressionReadMode> readMode) { this.readMode = readMode; this.flow = Later.Create(() => ExecutionFlow.CreatePath(ChildrenNodes.WhereType <IExpression>())); }