Skip to content

Commit

Permalink
Add WasmParser.dup() and CodePtr.dup() #208 from matthew-mojira/dup-p…
Browse files Browse the repository at this point in the history
…arser
  • Loading branch information
titzer authored Oct 16, 2024
2 parents ecbab33 + 3d5e90c commit fc4c34a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/engine/CodePtr.v3
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,7 @@ class CodePtr extends DataReader {
skip_immediates(opcode.imms);
return opcode;
}
def dup() -> CodePtr {
return CodePtr.new(null).reset(Ranges.dup(data), pos, limit);
}
}
6 changes: 5 additions & 1 deletion src/engine/WasmParser.v3
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,13 @@ class WasmParser(extensions: Extension.set, limits: Limits, module: Module,
if (b < ' ' || b > 127) b = '.';
return b;
}

def dup() -> WasmParser {
return WasmParser.new(extensions, limits, module, ErrorGen.new(""), CodePtr.!(decoder).dup());
}
}
type Catch(tag: TagDecl, exnref: bool, depth: u32) {
}
type ContHandler(tag: TagDecl, depth: u32) {

}
}

0 comments on commit fc4c34a

Please sign in to comment.