Пример #1
0
        /// <summary>
        /// Executes a call to a language binding class.
        /// </summary>
        /// <param name="expr"></param>
        /// <returns></returns>
        public object VisitBindingCall(BindingCallExpr expr)
        {
            var method = expr.Name;

            // 1. Resolve the parameters.
            ParamHelper.ResolveParametersToHostLangValues(expr.ParamListExpressions, expr.ParamList, this);
            
            // 2. Push call into stack
            expr.Ctx.State.Stack.Push(expr.FullName, null);

            // 3. Call language binding method/function.
            var binding = new MetaCompiler();
            binding.Ctx = expr.Ctx;
            var result = binding.ExecuteFunction(method, new object[] { expr });

            result = FunctionHelper.CheckConvert(result);
            // 4. Pop the call stack
            expr.Ctx.State.Stack.Pop();
            return result;
        }
Пример #2
0
 /// <summary>
 /// Runs the compiler hook/function call on the compiler languge binding class.
 /// </summary>
 /// <param name="objectName"></param>
 /// <param name="method"></param>
 /// <param name="settings"></param>
 /// <param name="expr"></param>
 /// <returns></returns>
 private object RunCompilerMethod(string objectName, string method, LangSettings settings, FunctionCallExpr expr)
 {
     var binding = new MetaCompiler();
     binding.Ctx = expr.Ctx;
     binding.ExecuteFunction(method, new object[] {expr});
     return LObjects.Null;
 }