Пример #1
0
        private void WriteFunction(Programmer.Function function)
        {
            d_writer.WriteLine("Cdn.Networks.{0}.prototype.{1} = function ({2}) {{", CPrefix, function.Name, GenerateArgsList(function));

            d_writer.WriteLine("\treturn {0};", FunctionToJS(function));
            d_writer.WriteLine("}");
            d_writer.WriteLine();
        }
Пример #2
0
        private string FunctionToJS(Programmer.Function function)
        {
            CLike.Context context = new Context(d_program,
                                                d_options,
                                                function.Expression,
                                                GenerateMapping("x{0}", function.Arguments));

            return(InstructionTranslator.QuickTranslate(context));
        }
Пример #3
0
        private string GenerateArgsList(Programmer.Function function)
        {
            List <string> ret = new List <string>(function.NumArguments + 2);

            if (function.IsCustom)
            {
                int i = 0;

                foreach (var arg in function.CustomArguments)
                {
                    ret.Add(String.Format("x{0}", i));
                    ++i;
                }
            }
            else
            {
                for (int i = 0; i < function.OrderedArguments.Count; ++i)
                {
                    ret.Add(String.Format("x{0}", i));
                }
            }

            return(String.Join(", ", ret.ToArray()));
        }
Пример #4
0
 public override string FunctionCallName(Programmer.Function function)
 {
     return(ThisCall(function.Name));
 }
Пример #5
0
 public virtual string FunctionCallName(Programmer.Function function)
 {
     return(ThisCall(function.Name));
 }
Пример #6
0
 public Function(Programmer.Function function)
 {
     d_function = function;
 }