[Nice-commit] Nice/src/bossa/syntax Node.java,1.59,1.60
Brought to you by:
bonniot
From: Daniel B. <bo...@us...> - 2004-06-17 12:15:59
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12952/src/bossa/syntax Modified Files: Node.java Log Message: Use less memory. Index: Node.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Node.java,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** Node.java 9 Dec 2003 15:21:05 -0000 1.59 --- Node.java 17 Jun 2004 12:15:50 -0000 1.60 *************** *** 35,39 **** this.propagate = propagate; } ! Node(List /* of Node */ children, int propagate) --- 35,39 ---- this.propagate = propagate; } ! Node(List /* of Node */ children, int propagate) *************** *** 53,65 **** } - void addFirstChild(Node n) - { - if (n==null) - Internal.error("null child in Node.addChild for node "+this); - - if (children == null) children=new ArrayList(); - children.add(0, n); - } - final Node child(Node n) { --- 53,56 ---- *************** *** 86,92 **** List addChildren(List c) { ! // OPTIM: do not allocate each time, but beware sharing an empty list ! // as some client might modify it. ! if(c==null) return new LinkedList(); for(Iterator i = c.iterator(); i.hasNext();) addChild((Node) i.next()); --- 77,83 ---- List addChildren(List c) { ! if (c == null) ! return Collections.EMPTY_LIST; ! for(Iterator i = c.iterator(); i.hasNext();) addChild((Node) i.next()); *************** *** 174,177 **** --- 165,171 ---- { case none: + this.scope = outer; + this.typeScope = typeOuter; + break; case down: this.scope = new VarScope(outer,varSymbols); |