public IndirectCallContext(StackContext originalSctx, Engine parentEngine, Application parentApplication, IEnumerable<string> importedNamespaces, IIndirectCall callable, PValue[] args) { if (parentEngine == null) throw new ArgumentNullException("parentEngine"); if (parentApplication == null) throw new ArgumentNullException("parentApplication"); if (importedNamespaces == null) throw new ArgumentNullException("importedNamespaces"); if (callable == null) throw new ArgumentNullException("callable"); if (args == null) throw new ArgumentNullException("args"); _engine = parentEngine; _application = parentApplication; _importedNamespaces = (importedNamespaces as SymbolCollection) ?? new SymbolCollection(importedNamespaces); _callable = callable; _arguments = args; _originalStackContext = originalSctx; }
public IndirectCallContext(Engine parentEngine, Application parentApplication, IEnumerable<string> importedNamespaces, IIndirectCall callable, PValue[] args) : this(null, parentEngine, parentApplication, importedNamespaces, callable, args) { }
public static PValue Run( StackContext sctx, IIndirectCall f, PValue left, IEnumerable<PValue> source) { if (sctx == null) throw new ArgumentNullException("sctx"); if (f == null) throw new ArgumentNullException("f"); if (left == null) left = PType.Null.CreatePValue(); if (source == null) source = new PValue[] {}; foreach (var right in source) { left = f.IndirectCall(sctx, new[] {left, right}); } return left; }
public static PValue Run( StackContext sctx, IIndirectCall f, PValue right, IEnumerable<PValue> source) { if (sctx == null) throw new ArgumentNullException("sctx"); if (f == null) throw new ArgumentNullException("f"); if (right == null) right = PType.Null.CreatePValue(); if (source == null) source = new PValue[] {}; var lst = new List<PValue>(source); for (var i = lst.Count - 1; i >= 0; i--) { right = f.IndirectCall(sctx, new[] {lst[i], right}); } return right; }
protected static IEnumerable<PValue> CoroutineRun(ContextCarrier sctxCarrier, IIndirectCall f, IEnumerable<PValue> source) { var sctx = sctxCarrier.StackContext; foreach (var x in source) yield return f != null ? f.IndirectCall(sctx, new[] {x}) : x; }
public IndirectCallContext(StackContext parent, IIndirectCall callable, PValue[] args) : this( parent, parent.ParentEngine, parent.ParentApplication, parent.ImportedNamespaces, callable, args) { }