2007-03-01 Peter Dettman <peter.dettman@iinet.net.au>
authorMiguel de Icaza <miguel@gnome.org>
Tue, 6 Mar 2007 05:03:47 +0000 (05:03 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Tue, 6 Mar 2007 05:03:47 +0000 (05:03 -0000)
* mjs-most.tests: Enable ecma/Boolean/15.6.3.1-3.js.

* mjs-most.fail: Delete ecma/String/15.5.5.1.js,
ecma/FunctionObjects/15.3.3.1-3.js, ecma/Number/15.7.3.3-2.js,
and ecma/Number/15.7.3.5-2.js, as they no longer fail.

2007-03-01  Peter Dettman  <peter.dettman@iinet.net.au>

* expression.cs: Expression.Emit changed to correctly leave a value on the
stack or not according to the 'no_effect' field, including the case where
the final AST in the list is an Assign. Fixed a reentrancy bug in Args.Emit.

* Block.cs, ForIn.cs, Statement.cs: Correctly resolve child expressions with
"no effect" where they should behave as statements.

svn path=/trunk/mcs/; revision=73783

mcs/class/Microsoft.JScript/Microsoft.JScript/Block.cs
mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog
mcs/class/Microsoft.JScript/Microsoft.JScript/ForIn.cs
mcs/class/Microsoft.JScript/Microsoft.JScript/Statement.cs
mcs/class/Microsoft.JScript/Microsoft.JScript/expression.cs
mcs/class/Microsoft.JScript/Test/Mozilla/ChangeLog
mcs/class/Microsoft.JScript/Test/Mozilla/mjs-most.fail
mcs/class/Microsoft.JScript/Test/Mozilla/mjs-most.tests

index 5d3d443b0e22f3a54e91f339a86659fbe5bb3bc8..0355e53879cdeec378d85d30bdb5faaeb0cb8e9e 100644 (file)
@@ -108,21 +108,13 @@ namespace Microsoft.JScript {
                internal override bool Resolve (Environment env)
                {
                        AST e;
-                       bool no_effect;
                        bool r = true;
                        int i, n = elems.Count;
 
-                       if (parent == null || parent is FunctionDeclaration)
-                               no_effect = true;
-                       else
-                               no_effect = false;
-                       
-                       n = elems.Count;
-                       
                        for (i = 0; i < n; i++) {
                                e = (AST) elems [i];
                                if (e is Exp) 
-                                       r &= ((Exp) e).Resolve (env, no_effect);
+                                       r &= ((Exp) e).Resolve (env, true);
                                else 
                                        r &= e.Resolve (env);
                        }
index ef872555a06e081172fcd1001348b3e1d0118e04..c8f45f8bb6da7a381567370f049863a98fe61ec1 100644 (file)
@@ -1,3 +1,12 @@
+2007-03-01  Peter Dettman  <peter.dettman@iinet.net.au>
+
+       * expression.cs: Expression.Emit changed to correctly leave a value on the
+       stack or not according to the 'no_effect' field, including the case where
+       the final AST in the list is an Assign. Fixed a reentrancy bug in Args.Emit.
+
+       * Block.cs, ForIn.cs, Statement.cs: Correctly resolve child expressions with
+       "no effect" where they should behave as statements.
+
 2006-10-21  Miguel de Icaza  <miguel@novell.com>
 
        * JScriptCodeCompiler.cs: Ifdefed out unused code.
index 4c765872234b39985754c0fa7cc034897af2d014..c21ec4049faa3b62f2e5061cd351df8655039825 100644 (file)
@@ -84,8 +84,12 @@ namespace Microsoft.JScript {
                        if (obj != null)
                                r &= obj.Resolve (env);
 
-                       if (body != null)
-                               r &= body.Resolve (env);
+                       if (body != null) {
+                               if (body is Exp)
+                                       r &= ((Exp) body).Resolve (env, true);
+                               else
+                                       r &= body.Resolve (env);
+                       }
                        return r;
                }
 
index f04e9b64b76813bfe5df25a49beba74f30efd7f7..2300d0151692db8bd5f62c73c0a23af562edd664 100644 (file)
@@ -350,7 +350,10 @@ namespace Microsoft.JScript {
                        bool r = true;
 
                        if (stm != null)
-                               r &= stm.Resolve (env);
+                               if (stm is Exp)
+                                       r &= ((Exp) stm).Resolve (env, true);
+                               else
+                                       r &= stm.Resolve (env);
                        if (exp != null)
                                r &= exp.Resolve (env);
                        return r;
@@ -421,7 +424,10 @@ namespace Microsoft.JScript {
                                else 
                                        r &= exp.Resolve (env);
                        if (stm != null)
-                               r &= stm.Resolve (env);
+                               if (stm is Exp)
+                                       r &= ((Exp) stm).Resolve (env, true);
+                               else
+                                       r &= stm.Resolve (env);
                        return r;
                }
 
@@ -498,8 +504,14 @@ namespace Microsoft.JScript {
                {
                        bool r = true;
 
-                       foreach (AST ast in exprs)
-                               r &= ast.Resolve (env);
+                       for (int i = 0; i < 3; ++i) {
+                               AST e = exprs[i];
+                               if (e is Exp)
+                                       r &= ((Exp) e).Resolve (env, i != 1);
+                               else
+                                       r &= e.Resolve (env);
+                       }
+
                        if (stms != null)
                                r &= stms.Resolve (env);
                        return true;
@@ -630,8 +642,12 @@ namespace Microsoft.JScript {
                                foreach (Clause c in case_clauses)
                                        r &= c.Resolve (env);
                        if (default_clauses != null)
-                               foreach (AST dc in default_clauses)
-                                       r &= dc.Resolve (env);
+                               foreach (AST dc in default_clauses) {
+                                       if (dc is Exp)
+                                               r &= ((Exp) dc).Resolve (env, true);
+                                       else
+                                               r &= dc.Resolve (env);
+                               }
                        if (sec_case_clauses != null)
                                foreach (Clause sc in sec_case_clauses)
                                        r &= sc.Resolve (env);
@@ -724,8 +740,12 @@ namespace Microsoft.JScript {
                        bool r = true;
                        if (exp != null)
                                r &= exp.Resolve (env);
-                       foreach (AST ast in stm_list)
-                               r &= ast.Resolve (env);
+                       foreach (AST ast in stm_list) {
+                               if (ast is Exp)
+                                       r &= ((Exp) ast).Resolve (env, true);
+                               else
+                                       r &= ast.Resolve (env);
+                       }
                        return r;                       
                }
 
index eee9f29f92c6139109cc8b54594848eb80b8ede2..369eddb144f0f466d6931f5f0462955f36cf102e 100644 (file)
@@ -1759,6 +1759,9 @@ namespace Microsoft.JScript {
                        bool strong_type = BoundToMethod is MethodInfo;
                        ParameterInfo [] parameters = null;
 
+                       // We may be called more than once, so avoid modifying fields
+                       int expected_args = this.expected_args;
+
                        if (!BoundToDeclaredFunction) {
                                if (has_this)
                                        expected_args--;
@@ -1964,28 +1967,17 @@ namespace Microsoft.JScript {
 
                internal override bool Resolve (Environment env)
                {
-                       int i, n;
-                       object e;
+                       int n = exprs.Count - 1;
                        bool r = true;
-                       
-                       n = exprs.Count - 1;
+                       object e;
 
-                       for (i = 0; i < n; i++) {
+                       for (int i = 0; i <= n; i++) {
                                e = exprs [i];
                                if (e is Exp)
-                                       if (e is Assign)
-                                               r &= ((Assign) e).Resolve (env);
-                                       else
-                                               r &= ((Exp) e).Resolve (env, true);
-                       }
-                       e = exprs [n];
-                       if (e is Exp)
-                               if (e is Assign)
-                                       r &= ((Assign) e).Resolve (env);
+                                       r &= ((Exp) e).Resolve (env, i < n || no_effect);
                                else
-                                       r &= ((Exp) e).Resolve (env, no_effect);
-                       else 
-                               ((AST) e).Resolve (env);
+                                       r &= ((AST) e).Resolve (env);
+                       }
 
                        return r;
                }
@@ -1998,13 +1990,27 @@ namespace Microsoft.JScript {
 
                internal override void Emit (EmitContext ec)
                {
-                       int i, n = exprs.Count;
+                       int i, n = exprs.Count - 1;
                        AST exp;
 
                        for (i = 0; i < n; i++) {
                                exp = (AST) exprs [i];
                                exp.Emit (ec);
-                               CodeGenerator.EmitBox (ec.ig, exp);
+                       }
+                       if (n >= 0)
+                       {
+                               exp = (AST) exprs [n];
+                               if (exp is Assign) {
+                                       if (no_effect)
+                                               exp.Emit (ec);
+                                       else
+                                               CodeGenerator.EmitAssignAsExp (ec, exp);
+                               }
+                               else {
+                                       exp.Emit (ec);
+                                       if (!no_effect)
+                                               CodeGenerator.EmitBox (ec.ig, exp);
+                               }
                        }
                }
        }
index 13c5d363b816093a5eece892c21a1efc13629545..4114ba048feeec8726ab81e7760584cf50921ed5 100644 (file)
@@ -1,3 +1,11 @@
+2007-03-01  Peter Dettman  <peter.dettman@iinet.net.au>
+
+       * mjs-most.tests: Enable ecma/Boolean/15.6.3.1-3.js.
+
+       * mjs-most.fail: Delete ecma/String/15.5.5.1.js,
+       ecma/FunctionObjects/15.3.3.1-3.js, ecma/Number/15.7.3.3-2.js,
+       and ecma/Number/15.7.3.5-2.js, as they no longer fail.
+
 2006-01-13  Cesar Lopez Nataren  <cnataren@novell.com>
 
        * mjs-most.tests: Enable ecma/FunctionObjects/15.3.3.1-2.js,
index 7f6e310f8c483799c8ad0c6e1b6f0b7eb478e954..8b7330c3da8ccf642baecd632e1767812a87dfa7 100644 (file)
@@ -48,9 +48,6 @@ js1_2/function/definition-1.js
 js1_3/Script/script-001.js
 js1_4/Functions/function-001.js
 
-# System.NotImplementedException: The requested feature is not implemented. (Convert:ToForInObject)
-ecma/String/15.5.5.1.js
-
 # System.Exception: error JS5002 A: function expected.
 ecma_2/Exceptions/exception-001.js
 
@@ -76,9 +73,3 @@ js1_2/regexp/special_characters.js
 
 # Throw NotImplementedException when invoking Convert:ToForInObject
 ecma/Array/15.4.3.1-2.js
-
-# Throw NotImplementedException when invoking LateBinding::Delete
-ecma/FunctionObjects/15.3.3.1-3.js
-ecma/Number/15.7.3.3-2.js
-ecma/Number/15.7.3.5-2.jsc
-ecma/Number/15.7.3.5-2.js
index 633c2f5f902bcdd85affbfe944b744d3692f8c04..09927b1d375b60f4b52c82c4d2ff8c7b2066430a 100644 (file)
@@ -65,8 +65,7 @@ ecma/Boolean/15.6.1.js
 ecma/Boolean/15.6.2.js
 ecma/Boolean/15.6.3.1-1.js
 ecma/Boolean/15.6.3.1-2.js
-# invalid IL
-#ecma/Boolean/15.6.3.1-3.js
+ecma/Boolean/15.6.3.1-3.js
 # Invalid IL
 #ecma/Boolean/15.6.3.1-4.js
 ecma/Boolean/15.6.3.1-5.js