diff options
author | Thomas Lively <tlively@users.noreply.github.com> | 2017-08-02 20:20:14 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2017-08-02 20:20:14 -0700 |
commit | ffd9a72d28d36915fb173a6d52fbb6e43f7c15db (patch) | |
tree | 0dbd0f9d99fc20ab1c1e63395e8f399fd51cf806 /src/mixed_arena.h | |
parent | de15161e110f26212095c5cf4faf2e3668d2531b (diff) | |
download | binaryen-ffd9a72d28d36915fb173a6d52fbb6e43f7c15db.tar.gz binaryen-ffd9a72d28d36915fb173a6d52fbb6e43f7c15db.tar.bz2 binaryen-ffd9a72d28d36915fb173a6d52fbb6e43f7c15db.zip |
Get wasm2asm building again (#1107)
* Get wasm2asm building again
Updates CMakeLists.txt to have wasm2asm built by default, updates
wasm2asm.h to account for recent interface changes, and restores
JSPrinter functionality.
* Implement splice for array values
* Clean up wasm2asm testing
* Print semicolons after statements in blocks
* Cleanups and semicolons for condition arms
* Prettify semicolon emission
Diffstat (limited to 'src/mixed_arena.h')
-rw-r--r-- | src/mixed_arena.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mixed_arena.h b/src/mixed_arena.h index 47e718454..9354527ec 100644 --- a/src/mixed_arena.h +++ b/src/mixed_arena.h @@ -163,6 +163,8 @@ protected: } public: + struct Iterator; + T& operator[](size_t index) const { assert(index < usedElements); return data[index]; @@ -206,6 +208,16 @@ public: usedElements++; } + void erase(Iterator start_it, Iterator end_it) { + assert(start_it.parent == end_it.parent && start_it.parent == this); + assert(start_it.index <= end_it.index && end_it.index <= usedElements); + size_t size = end_it.index - start_it.index; + for (size_t cur = start_it.index; cur + size < usedElements; ++cur) { + data[cur] = data[cur + size]; + } + usedElements -= size; + } + void clear() { usedElements = 0; } @@ -257,6 +269,15 @@ public: index++; } + Iterator& operator+=(int off) { + index += off; + return *this; + } + + const Iterator operator+(int off) const { + return Iterator(*this) += off; + } + T& operator*() { return (*parent)[index]; } |