public static void Add(DeltinScript deltinScript, Scope scope)
        {
            var functions = GetFunctions(deltinScript);

            foreach (var function in functions)
            {
                scope.AddNativeMethod(function);
            }
            scope.AddNativeMethod(Parse.Lambda.WaitAsyncComponent.Method(deltinScript.Types));
        }
Ejemplo n.º 2
0
 public static void AddWorkshopFunctionsToScope(Scope scope, ITypeSupplier typeSupplier)
 {
     foreach (var function in WorkshopFunctions)
     {
         scope.AddNativeMethod(function);
     }
 }
Ejemplo n.º 3
0
 protected BaseLambda(string name, CodeType[] argumentTypes) : base(name)
 {
     CanBeDeleted  = false;
     CanBeExtended = false;
     Kind          = "constant";
     ArgumentTypes = argumentTypes ?? new CodeType[0];
     _objectScope  = new Scope("lambda");
     _objectScope.AddNativeMethod(new LambdaInvoke(this));
 }
Ejemplo n.º 4
0
        public static void Add(DeltinScript deltinScript, Scope scope)
        {
            var functions = GetFunctions(deltinScript);

            foreach (var function in functions)
            {
                scope.AddNativeMethod(function);
            }
        }
Ejemplo n.º 5
0
        public JsonType(JObject jsonData) : base("JSON")
        {
            objectScope.AddNativeMethod(new GetJsonPropertyFunction(this));

            foreach (JProperty prop in jsonData.Children <JProperty>())
            {
                JsonProperty newProperty = new JsonProperty(prop);
                Properties.Add(newProperty);
                objectScope.AddNativeVariable(newProperty.Var);
            }
        }
        public void Add <T>(Scope addToScope) where T : Element, new()
        {
            // value => ...
            var noIndex = GetFuncMethod();

            noIndex.Parameters = new CodeParameter[] {
                new CodeParameter("conditionLambda", ParameterDocumentation, new MacroLambda(null, ArrayOfType))
            };
            noIndex.Action = (actionSet, methodCall) =>
                             Element.Part <T>(actionSet.CurrentObject, ((LambdaAction)methodCall.ParameterValues[0]).Invoke(actionSet, new V_ArrayElement()));

            // (value, index) => ...
            var withIndex = GetFuncMethod();

            withIndex.Parameters = new CodeParameter[] {
                new CodeParameter("conditionLambda", ParameterDocumentation, new MacroLambda(null, ArrayOfType, null))
            };
            withIndex.Action = (actionSet, methodCall) =>
                               Element.Part <T>(actionSet.CurrentObject, ((LambdaAction)methodCall.ParameterValues[0]).Invoke(actionSet, new V_ArrayElement(), new V_CurrentArrayIndex()));

            addToScope.AddNativeMethod(new FuncMethod(noIndex));
            addToScope.AddNativeMethod(new FuncMethod(withIndex));
        }
Ejemplo n.º 7
0
 private void AddInvokeFunction()
 {
     InvokeFunction = new LambdaInvoke(this);
     _scope.AddNativeMethod(InvokeFunction);
     InvokeInfo = new LambdaInvokeInfo(this);
 }