switch core files over to baskets
[org.ibex.js.git] / src / org / ibex / js / Parser.java
index 3bf7852..9bd1791 100644 (file)
@@ -137,7 +137,7 @@ class Parser extends Lexer implements ByteCodes {
     }
 
     // Local variable management
-    List scopeStack = new ArrayList();
+    Basket.Array scopeStack = new Basket.Array();
     static class ScopeInfo {
         int base;
         int end;
@@ -148,20 +148,20 @@ class Parser extends Lexer implements ByteCodes {
     JS scopeKey(String name) {
         if(globalCache.get(name) != null) return null;
         for(int i=scopeStack.size()-1;i>=0;i--) {
-            JS key = (JS)((ScopeInfo) scopeStack.elementAt(i)).mapping.get(name);
+            JS key = (JS)((ScopeInfo) scopeStack.get(i)).mapping.get(name);
             if(key != null) return key;
         }
         globalCache.put(name,Boolean.TRUE);
         return null;
     }
     void scopeDeclare(String name) throws IOException {
-        ScopeInfo si = (ScopeInfo) scopeStack.lastElement();
+        ScopeInfo si = (ScopeInfo) scopeStack.peek();
         if(si.mapping.get(name) != null) throw pe("" + name + " already declared in this scope");
         si.mapping.put(name,JS.N(si.end++));
         globalCache.put(name,null);
     }
     void scopePush(JSFunction b) {
-        ScopeInfo prev = (ScopeInfo) scopeStack.lastElement();
+        ScopeInfo prev = (ScopeInfo) scopeStack.peek();
         ScopeInfo si = new ScopeInfo();
         si.base = prev.end;
         si.end = si.base;
@@ -183,7 +183,7 @@ class Parser extends Lexer implements ByteCodes {
         JSFunction ret = new JSFunction(sourceName, firstLine, null);
         if (sourceCode == null) return ret;
         Parser p = new Parser(sourceCode, sourceName, firstLine);
-        p.scopeStack.setSize(0);
+        p.scopeStack.clear();
         p.scopeStack.push(new ScopeInfo());
         p.scopePush(ret);
         while(true) {
@@ -820,7 +820,7 @@ class Parser extends Lexer implements ByteCodes {
             
             int catchJMPDistance = -1;
             if (peekToken() == CATCH) {
-                Vec catchEnds = new Vec();
+                Basket.List catchEnds = new Basket.Array();
                 boolean catchAll = false;
                 
                 catchJMPDistance = b.size - tryInsn;
@@ -877,7 +877,7 @@ class Parser extends Lexer implements ByteCodes {
                     scopePop(b);
                     
                     b.add(parserLine, JMP);
-                    catchEnds.addElement(new Integer(b.size-1));
+                    catchEnds.add(new Integer(b.size-1));
                     
                     for(int i=0; i<3; i++) if (writebacks[i] != -1) b.set(writebacks[i], JS.N(b.size-writebacks[i]));
                     b.add(parserLine, POP); // pop the element thats on the stack from the compare
@@ -887,7 +887,7 @@ class Parser extends Lexer implements ByteCodes {
                     b.add(parserLine, THROW);
                 
                 for(int i=0;i<catchEnds.size();i++) {
-                    int n = ((Integer)catchEnds.elementAt(i)).intValue();
+                    int n = ((Integer)catchEnds.get(i)).intValue();
                     b.set(n, JS.N(b.size-n));
                 }