* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / Microsoft.JScript / Microsoft.JScript / FunctionObject.cs
index 67c11392c1db5b4348b9c31f9788a46a4446a4ee..270dd70ad6af9d5125965c0fe11c266b85b7a8f0 100644 (file)
@@ -35,7 +35,7 @@ using System.Collections;
 
 namespace Microsoft.JScript {
 
-       public class FunctionObject : ScriptFunction {
+       public class FunctionObject : ScriptFunction, ICanModifyContext {
 
                internal string type_annot;
                internal Block body;
@@ -44,13 +44,13 @@ namespace Microsoft.JScript {
 
                internal FunctionObject (string name)
                {
-                       this._prototype = ObjectPrototype.Proto;
+                       this._prototype = ObjectConstructor.Ctr.ConstructObject ();
                        this.name = name;
                }
 
                internal FunctionObject (MethodInfo info)
                {
-                       this._prototype = ObjectPrototype.Proto;
+                       this._prototype = ObjectConstructor.Ctr.ConstructObject ();
                        this.method = info;
                        this.name = info.Name;
                        this.attr = info.Attributes;
@@ -59,7 +59,7 @@ namespace Microsoft.JScript {
 
                internal FunctionObject (string name, FormalParameterList p, string ret_type, Block body, Location location)
                {
-                       this._prototype = ObjectPrototype.Proto;
+                       this._prototype = ObjectConstructor.Ctr.ConstructObject ();
                        //
                        // FIXME
                        // 1) Must collect the attributes given.
@@ -119,5 +119,15 @@ namespace Microsoft.JScript {
                                return types;
                        }
                }
+
+               void ICanModifyContext.PopulateContext (Environment env, string ns)
+               {
+                       ((ICanModifyContext) body).PopulateContext (env, ns);
+               }
+
+               void ICanModifyContext.EmitDecls (EmitContext ec)
+               {
+                       ((ICanModifyContext) body).EmitDecls (ec);
+               }               
        }
 }