Skip to content

Commit 1b8c2fb

Browse files
committed
Utility
1 parent 83a02a1 commit 1b8c2fb

2 files changed

Lines changed: 8 additions & 15 deletions

File tree

chapter25/src/main/java/com/seaofnodes/simple/IterPeeps.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.seaofnodes.simple;
22

33
import com.seaofnodes.simple.codegen.CodeGen;
4+
import com.seaofnodes.simple.codegen.Opto;
45
import com.seaofnodes.simple.type.Type;
56
import com.seaofnodes.simple.type.TypeInteger;
67
import com.seaofnodes.simple.util.Ary;
@@ -180,12 +181,18 @@ public void addAll( Ary<E> ary ) {
180181
for( E n : ary )
181182
push(n);
182183
}
184+
public void addAll( E[] es ) {
185+
for( E n : es )
186+
push(n);
187+
}
188+
183189

184190
/**
185191
* True if Node is on the WorkList
186192
*/
187193
public boolean on( E x ) { return _on.get(x._nid); }
188194
boolean isEmpty() { return _len==0; }
195+
Node[] asAry() { return Arrays.copyOf(_es,_len); }
189196

190197
/**
191198
* Removes a random Node from the WorkList; null if WorkList is empty

chapter25/src/main/java/com/seaofnodes/simple/codegen/ParseAll.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.seaofnodes.simple.codegen;
22

33
import com.seaofnodes.simple.Parser;
4+
import com.seaofnodes.simple.IterPeeps;
45
import com.seaofnodes.simple.node.*;
56
import com.seaofnodes.simple.print.*;
67
import com.seaofnodes.simple.type.*;
@@ -132,21 +133,6 @@ private static void parseAll(CodeGen code, CompUnit cunit) {
132133
code.add(add);
133134
return null;
134135
} );
135-
136-
//// Really Bad Idea
137-
//boolean[] done = new boolean[1];
138-
//while( !done[0] ) {
139-
// done[0] = true;
140-
// code._stop.walk( (Node n) -> {
141-
// Type t = n.compute();
142-
// if( !t.isa(n._type) ) {
143-
// n._type = t;
144-
// code.add(n);
145-
// done[0] = false;
146-
// }
147-
// return null;
148-
// } );
149-
//}
150136
}
151137

152138
// Parse one Simple source code file. Add all the FRefs produced to the worklist.

0 commit comments

Comments
 (0)