Author: cesar
Date: 2005-07-06 20:15:04 -0400 (Wed, 06 Jul 2005)
New Revision: 47020
Modified:
trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog
trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/FunctionExpression.cs
trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/Parser.cs
trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/expression.cs
Log:
2005-07-06 Cesar Lopez Nataren <[EMAIL PROTECTED]>
* FunctionExpression.cs (build_closure): Use CodeGenerator.load_engine.
* Parser.cs: Restore pn as the parent.
* expression.cs: Added is_dynamic_function field to class
Call. It's not enough knowing if the parent is a
FunctionExpression/FunctionDeclaration, we must assure that we
are really inside a FunctionExpression/FunctionDeclaration in
order to know in which place is the engine. setup_late_call_args
and get_global_scope_or_this used the new field for loading the
engine.
Modified: trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog
===================================================================
--- trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog
2005-07-06 22:22:25 UTC (rev 47019)
+++ trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog
2005-07-07 00:15:04 UTC (rev 47020)
@@ -1,3 +1,16 @@
+2005-07-06 Cesar Lopez Nataren <[EMAIL PROTECTED]>
+
+ * FunctionExpression.cs (build_closure): Use CodeGenerator.load_engine.
+
+ * Parser.cs: Restore pn as the parent.
+ * expression.cs: Added is_dynamic_function field to class
+ Call. It's not enough knowing if the parent is a
+ FunctionExpression/FunctionDeclaration, we must assure that we
+ are really inside a FunctionExpression/FunctionDeclaration in
+ order to know in which place is the engine. setup_late_call_args
+ and get_global_scope_or_this used the new field for loading the
+ engine.
+
2005-07-05 Cesar Lopez Nataren <[EMAIL PROTECTED]>
* LateBinding.cs (CallValue): throw a NotImplementedException
Modified:
trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/FunctionExpression.cs
===================================================================
--- trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/FunctionExpression.cs
2005-07-06 22:22:25 UTC (rev 47019)
+++ trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/FunctionExpression.cs
2005-07-07 00:15:04 UTC (rev 47020)
@@ -154,15 +154,7 @@
ig.Emit (OpCodes.Ldc_I4_0); // FIXME: this hard coded
for now.
ig.Emit (OpCodes.Ldc_I4_0); // FIXME: this hard coded
for now.
ig.Emit (OpCodes.Ldstr,
"STRING_REPRESENTATION_OF_THE_FUNCTION"); // FIXME
-
- if (parent == null || parent.GetType () == typeof
(ScriptBlock)) {
- ig.Emit (OpCodes.Ldarg_0);
- ig.Emit (OpCodes.Ldfld, typeof
(ScriptObject).GetField ("engine"));
- } else if (parent != null &&
- (parent.GetType () == typeof
(FunctionDeclaration)
- || parent.GetType () == typeof
(FunctionExpression)))
- ig.Emit (OpCodes.Ldarg_1);
-
+ CodeGenerator.load_engine (InFunction, ig);
ig.Emit (OpCodes.Call, typeof
(FunctionExpression).GetMethod ("JScriptFunctionExpression"));
ig.Emit (OpCodes.Stloc, local_func);
ig.Emit (OpCodes.Ldloc, local_func);
Modified: trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/Parser.cs
===================================================================
--- trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/Parser.cs
2005-07-06 22:22:25 UTC (rev 47019)
+++ trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/Parser.cs
2005-07-07 00:15:04 UTC (rev 47020)
@@ -997,7 +997,7 @@
pn = PrimaryExpr (parent);
} else
pn = PrimaryExpr (parent);
- return MemberExprTail (parent, allow_call_syntax, pn);
+ return MemberExprTail (pn, allow_call_syntax, pn);
}
AST MemberExprTail (AST parent, bool allow_call_syntax, AST pn)
Modified: trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/expression.cs
===================================================================
--- trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/expression.cs
2005-07-06 22:22:25 UTC (rev 47019)
+++ trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/expression.cs
2005-07-07 00:15:04 UTC (rev 47020)
@@ -533,6 +533,7 @@
internal Args args;
internal object binding;
internal Type bind_type;
+ private bool is_dynamic_function = false;
internal Call (AST parent, AST exp)
{
@@ -771,7 +772,13 @@
internal void get_global_scope_or_this (ILGenerator ig)
{
- CodeGenerator.load_engine (InFunction, ig);
+ is_dynamic_function = parent is FunctionExpression &&
parent == member_exp;
+
+ if (is_dynamic_function) {
+ ig.Emit (OpCodes.Ldarg_0);
+ ig.Emit (OpCodes.Ldfld, typeof
(ScriptObject).GetField ("engine"));
+ } else
+ CodeGenerator.load_engine (InFunction, ig);
ig.Emit (OpCodes.Call, typeof
(Microsoft.JScript.Vsa.VsaEngine).GetMethod ("ScriptObjectStackTop"));
Type iact_obj = typeof (IActivationObject);
ig.Emit (OpCodes.Castclass, iact_obj);
@@ -824,12 +831,11 @@
ig.Emit (OpCodes.Ldc_I4_0);
ig.Emit (OpCodes.Ldc_I4_0);
- if (InFunction)
- ig.Emit (OpCodes.Ldarg_1);
- else {
+ if (is_dynamic_function) {
ig.Emit (OpCodes.Ldarg_0);
ig.Emit (OpCodes.Ldfld, typeof
(ScriptObject).GetField ("engine"));
- }
+ } else
+ CodeGenerator.load_engine (InFunction, ig);
}
void emit_func_call (MethodBuilder mb, EmitContext ec)
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches