2003/11/13 09:15:12
[org.ibex.core.git] / src / org / xwt / js / Parser.java
index ffb12d8..b3c1742 100644 (file)
@@ -350,9 +350,9 @@ class Parser extends Lexer implements ByteCodes {
             break;
         }
         case LP: {
-            int n = parseArgs(b, false);
+            int n = parseArgs(b);
 
-            // if the object supports GETCALL, we use this, and jump over the following two instructions
+            // if the object supports CALLMETHOD, we use this, and jump over the following two instructions
             b.add(parserLine,CALLMETHOD,new Integer(n));
             b.add(parserLine,GET);
             b.add(parserLine,CALL,new Integer(n));
@@ -397,7 +397,7 @@ class Parser extends Lexer implements ByteCodes {
 
         switch (tok) {
         case LP: {  // invocation (not grouping)
-            int n = parseArgs(b, true);
+            int n = parseArgs(b);
             b.add(parserLine, CALL, new Integer(n));
             break;
         }
@@ -476,13 +476,13 @@ class Parser extends Lexer implements ByteCodes {
     
     // parse a set of comma separated function arguments, assume LP has already been consumed
     // if swap is true, (because the function is already on the stack) we will SWAP after each argument to keep it on top
-    private int parseArgs(JSFunction b, boolean swap) throws IOException {
+    private int parseArgs(JSFunction b) throws IOException {
         int i = 0;
         while(peekToken() != RP) {
             i++;
             if (peekToken() != COMMA) {
                 startExpr(b, NO_COMMA);
-                if (swap) b.add(parserLine, SWAP);
+                b.add(parserLine, SWAP, new Integer(2));
                 if (peekToken() == RP) break;
             }
             consume(COMMA);