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}"); } }
private IfBranch(IExpression condition, IEnumerable <IExpression> body, IfBranch next) { this.condition = condition; // we have to postpone calculating read-mode because the last instruction can be function call // and it is resolved only after finding its target if (!body.Any()) { body = new[] { UnitLiteral.Create() } } ; this.Body = Block.Create((block) => block.Instructions.Last().ReadMode, body); this.Next = next; this.attachPostConstructor(); this.flow = Later.Create(() => this.IsElse ? ExecutionFlow.CreateElse(Body, Next) : ExecutionFlow.CreateFork(Condition, Body, Next)); }
private BoolOperator(OpMode mode, IExpression lhs, IExpression rhs) : base(ExpressionReadMode.ReadRequired) { this.Mode = mode; this.lhs = lhs; this.rhs = rhs; this.attachPostConstructor(); this.flow = Later.Create(() => { switch (this.Mode) { case OpMode.And: return(ExecutionFlow.CreateFork(Lhs, Rhs, null)); case OpMode.Or: return(ExecutionFlow.CreateFork(Lhs, null, Rhs)); default: throw new InvalidOperationException(); } }); }
public UIDialogResult(ExecutionFlow execution, SendReport report) { this.Execution = execution; this.Report = report; }
internal UIDialogResult(ExecutionFlow execution, SendReport report) { this.Execution = execution; this.Report = report; }
public UIDialogResult(ExecutionFlow execution, bool sendReport) { Execution = execution; SendReport = sendReport; }
public UIDialogResult(ExecutionFlow execution, bool sendReport) { Execution = execution; SendReport = sendReport; }
protected Expression(Option <ExpressionReadMode> readMode) { this.readMode = readMode; this.flow = Later.Create(() => ExecutionFlow.CreatePath(ChildrenNodes.WhereType <IExpression>())); }