static bool CallStaticConstructors(IdContainer Container, CodeScopeNode Scope, PluginRoot Plugin, CodeString Code) { for (var i = 0; i < Container.Children.Count; i++) { if (!CallStaticConstructors(Container.Children[i], Scope, Plugin, Code)) { return(false); } } for (var i = 0; i < Container.IdentifierList.Count; i++) { var Ctor = Container.IdentifierList[i] as Constructor; if (Ctor == null || (Ctor.Flags & IdentifierFlags.Static) == 0) { continue; } if (!Plugin.Begin()) { return(false); } var CtorNode = Plugin.NewNode(new IdExpressionNode(Ctor, Code)); if (CtorNode == null) { Plugin.Reset(); return(false); } var NodeCh = new ExpressionNode[] { CtorNode }; var Node = Plugin.NewNode(new OpExpressionNode(Operator.Call, NodeCh, Code)); if (Node == null || Plugin.End(ref Node) == PluginResult.Failed) { Plugin.Reset(); return(false); } Scope.Children.Add(new Command(Scope, Code, CommandType.Expression) { Expressions = new List <ExpressionNode>() { Node }, }); } return(true); }
public ExpressionNode Copy(PluginRoot Plugin, PluginFunc Func = null, BeginEndMode Mode = BeginEndMode.Both, CodeString Code = new CodeString(), bool LeftType = false) { if ((Mode & BeginEndMode.Begin) != 0 && !Plugin.Begin()) { return(null); } if (!Code.IsValid) { Code = this.Code; } var Ret = Copy(Plugin.State, Code, x => { if (Func != null) { var Res = Func(ref x); if (Res == PluginResult.Failed) { return(null); } if (Res == PluginResult.Interrupt || Res == PluginResult.Ready) { return(x); } } return(Plugin.NewNode(x)); }); if ((Mode & BeginEndMode.End) != 0 && Ret != null) { Ret = Plugin.End(Ret); } if (Ret != null && LeftType) { Ret.Type = Type; } return(Ret); }
public ExpressionNode CallNewNode(PluginRoot Plugin, BeginEndMode Mode = BeginEndMode.Both) { if ((Mode & BeginEndMode.Begin) != 0 && !Plugin.Begin()) { return(null); } var RetValue = this; var Res = CallNewNode_NoBeginEnd(ref RetValue, Plugin); if (Res == PluginResult.Failed) { return(null); } if ((Mode & BeginEndMode.End) != 0) { RetValue = Plugin.End(RetValue); } return(RetValue); }