Browse Source

Fixing embedded function declarations

Sebastien Ros 11 years ago
parent
commit
33dfee399b

+ 2 - 3
Jint/Native/Function/FunctionConstructor.cs

@@ -79,7 +79,6 @@ namespace Jint.Native.Function
 
                 body = TypeConverter.ToString(arguments[argCount-1]);
             }
-            body = TypeConverter.ToString(body);
             
             var parameters = this.ParseArgumentNames(p);
             var parser = new JavaScriptParser();
@@ -110,8 +109,8 @@ namespace Jint.Native.Function
                                 Type = SyntaxNodes.Identifier,
                                 Name = x
                             }).ToArray(),
-                        FunctionDeclarations = new List<FunctionDeclaration>(),
-                        VariableDeclarations = new List<VariableDeclaration>()
+                        FunctionDeclarations = function.FunctionDeclarations,
+                        VariableDeclarations = function.VariableDeclarations
                     },  
                 LexicalEnvironment.NewDeclarativeEnvironment(Engine, Engine.ExecutionContext.LexicalEnvironment),
                 function.Strict

+ 1 - 1
Jint/Native/Function/FunctionPrototype.cs

@@ -33,7 +33,7 @@ namespace Jint.Native.Function
         {
             FastAddProperty("constructor", Engine.Function, true, false, true);
             FastAddProperty("toString", new ClrFunctionInstance(Engine, ToString), true, false, true);
-            FastAddProperty("apply", new ClrFunctionInstance(Engine, Apply), true, false, true);
+            FastAddProperty("apply", new ClrFunctionInstance(Engine, Apply, 2), true, false, true);
             FastAddProperty("call", new ClrFunctionInstance(Engine, CallImpl, 1), true, false, true);
             FastAddProperty("bind", new ClrFunctionInstance(Engine, Bind, 1), true, false, true);
         }