private void SerializeFunctionDefinition(List<string> output, FunctionDefinition funDef, string indention, bool isConstructor)
        {
            output.Add(indention);
            if (isConstructor)
            {
                output.Add("constructor");
            }
            else
            {
                output.Add("function ");
                output.Add(funDef.Name);
            }

            output.Add("(");
            bool first = true;
            for (int i = 0; i < funDef.ArgNameTokens.Length; ++i)
            {
                string argName = funDef.ArgNameTokens[i].Value;
                if (argName == "self") continue;
                if (first) first = false;
                else output.Add(", ");
                output.Add(argName);
                if (funDef.ArgDefaultValues[i] != null)
                {
                    output.Add("=");
                    SerializeExpression(output, funDef.ArgDefaultValues[i]);
                }
            }
            output.Add(") {");
            if (funDef.Body.Length > 0)
            {
                output.Add("\n");
                SerializeBlock(output, funDef.Body, indention + "\t");

                output.Add(indention);
                output.Add("}\n");
            }
            else
            {
                output.Add(" }\n");
            }
        }
 private void SerializeFunctionDefinition(List<string> output, FunctionDefinition funDef, string indention)
 {
     output.Add(indention);
     output.Add("function ");
     output.Add(funDef.Name);
     output.Add("(");
     for (int i = 0; i < funDef.ArgNameTokens.Length; ++i)
     {
         if (i > 0) output.Add(", ");
         output.Add(funDef.ArgNameTokens[i].Value);
         if (funDef.ArgDefaultValues[i] != null) {
             output.Add("=");
             SerializeExpression(output, funDef.ArgDefaultValues[i]);
         }
     }
     output.Add(") {\n");
     SerializeBlock(output, funDef.Body, indention + "\t");
     output.Add(indention);
     output.Add("}\n\n");
 }