protected PluginResult ResolveNode(ref ExpressionNode Node) { if (Node.InterrupterPlugin != -1) { if (Node.InterrupterPlugin != Array.IndexOf(Parent.Plugins, this)) { return(PluginResult.Succeeded); } var Res = ForceContinue(ref Node); if (Res != PluginResult.Succeeded) { return(Res); } if (Parent.FinishNode(ref Node, false) == PluginResult.Failed) { return(PluginResult.Failed); } return(PluginResult.Ready); } return(PluginResult.Succeeded); }
public ExpressionNode MakeCasts(PluginRoot Plugin, ExpressionNode Node) { if (Static) { throw new InvalidOperationException(); } Node = Plugin.FinishNode(Node); if (Node == null) { return(null); } var State = Plugin.State; var CurrentType = MemberOf.Type; for (var i = 0; i < Scopes.Length; i++) { var Base = GetBaseForNode(CurrentType, Scopes[i]); if (Base == null) { return(null); } var CastCh1 = Plugin.NewNode(new IdExpressionNode(Base, Node.Code)); if (CastCh1 == null) { return(null); } var CastCh = new ExpressionNode[] { Node, CastCh1 }; Node = Plugin.NewNode(new OpExpressionNode(Operator.Cast, CastCh, Node.Code)); if (Node == null) { return(null); } CurrentType = Base; } return(Node); }
public bool CalcValue(PluginRoot Plugin, BeginEndMode Mode = BeginEndMode.Both, bool CreateAssignNodes = false, bool EnableUntyped = false) { InitValue = null; if (InitString.IsValid) { var NMode = Mode & BeginEndMode.Begin; InitValue = Expressions.CreateExpression(InitString, Plugin, NMode); if (InitValue == null) { return(false); } if (CreateAssignNodes) { var Node = Expressions.CreateReference(Plugin.Container, this, Plugin, InitString); if (Node == null) { return(false); } InitValue = Expressions.SetValue(Node, InitValue, Plugin, InitString, false); if (InitValue == null) { return(false); } } InitValue = Plugin.FinishNode(InitValue); if (InitValue == null) { return(false); } if (!CreateAssignNodes && TypeOfSelf.RealId is AutomaticType) { if (!EnableUntyped && InitValue.Type.RealId is AutomaticType) { Plugin.State.Messages.Add(MessageId.Untyped, Name); return(false); } Children[0] = InitValue.Type; } var TypeMgrnPlugin = Plugin.GetPlugin <TypeMngrPlugin>(); if (!TypeOfSelf.IsEquivalent(InitValue.Type) && !(TypeOfSelf.RealId is AutomaticType)) { InitValue = TypeMgrnPlugin.Convert(InitValue, TypeOfSelf, InitString); if (InitValue == null) { return(false); } } if ((Mode & BeginEndMode.End) != 0) { InitValue = Plugin.End(InitValue); if (InitValue == null) { return(false); } } var ConstVal = InitValue as ConstExpressionNode; if (ConstVal != null) { ConstInitValue = ConstVal.Value; } } else if (TypeOfSelf.RealId is AutomaticType) { if (!EnableUntyped) { Plugin.State.Messages.Add(MessageId.Untyped, Name); return(false); } } return(true); }