diff -r 6c1fa412c72d -r dd4dabfead82 rt/vm/src/main/java/org/apidesign/vm4brwsr/Bck2Brwsr.java
--- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/Bck2Brwsr.java Fri Mar 13 11:41:04 2015 +0100
+++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/Bck2Brwsr.java Fri Sep 11 14:51:09 2015 +0200
@@ -422,10 +422,10 @@
*/
public static final class Flow {
private final MethodData m;
- private byte[] ops;
- Flow(MethodData m) {
+ private final Appendable emit;
+ Flow(MethodData m, Appendable emit) {
this.m = m;
- ops = new byte[m.getCode().length];
+ this.emit = emit;
}
/** Access to bytecode of the method to analyse.
@@ -442,47 +442,12 @@
public String getMethodName() {
return m.getName();
}
-
- public void beginLoopAt(int bci) {
- ops[bci] |= 0x10;
- }
-
- public void beginIfAt(int bci) {
- ops[bci] |= 0x20;
- }
-
- public void breakAt(int bci) {
- ops[bci] |= 0x40;
- }
-
- public void beginElseAt(int bci) {
- ops[bci] |= 0x80;
- }
-
- public void endAt(int bci) {
- int cnt = (ops[bci] & 0x0f) + 1;
- int rest = ops[bci] & 0xf0;
- ops[bci] = (byte)(rest | cnt);
- }
-
- boolean isFlow(int at) {
- return ops[at] != 0;
- }
- boolean isLoop(int at) {
- return (ops[at] & 0x10) != 0;
- }
- boolean isIf(int at) {
- return (ops[at] & 0x20) != 0;
- }
- boolean isBreak(int at) {
- return (ops[at] & 0x40) != 0;
- }
- boolean isElse(int at) {
- return (ops[at] & 0x80) != 0;
- }
- int isEnd(int at) {
- return (ops[at] & 0x0f);
+ /** Emits JavaScript to the final JavaScript output.
+ * @param seq text to emit
+ */
+ public void emit(CharSequence seq) throws IOException {
+ this.emit.append(seq);
}
/** Provider of advanced analysis of the code flow inside of
@@ -500,7 +465,7 @@
* @return true
if the analysis was successful,
* false
otherwise
*/
- public boolean analyze(Flow request);
+ public boolean analyze(Flow request) throws IOException;
}
}