Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/wasm-interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -620,13 +620,13 @@ class ModuleInstance {
}
Flow visitSelect(Select *curr) {
NOTE_ENTER("Select");
Flow condition = visit(curr->condition);
if (condition.breaking()) return condition;
NOTE_EVAL1(condition.value);
Flow ifTrue = visit(curr->ifTrue);
if (ifTrue.breaking()) return ifTrue;
Flow ifFalse = visit(curr->ifFalse);
if (ifFalse.breaking()) return ifFalse;
Flow condition = visit(curr->condition);
if (condition.breaking()) return condition;
NOTE_EVAL1(condition.value);
return condition.value.geti32() ? ifTrue : ifFalse; // ;-)
}
Flow visitReturn(Return *curr) {
Expand Down
8 changes: 4 additions & 4 deletions src/wasm-s-parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class SExpressionWasmBuilder {

public:
// Assumes control of and modifies the input.
SExpressionWasmBuilder(AllocatingModule& wasm, Element& module, std::function<void ()> onError, bool debug=false) : wasm(wasm), allocator(wasm.allocator), onError(onError), debug(debug) {
SExpressionWasmBuilder(AllocatingModule& wasm, Element& module, std::function<void ()> onError, bool debug=false) : wasm(wasm), allocator(wasm.allocator), onError(onError), importCounter(0), debug(debug) {
assert(module[0]->str() == MODULE);
functionCounter = 0;
for (unsigned i = 1; i < module.size(); i++) {
Expand Down Expand Up @@ -630,9 +630,9 @@ class SExpressionWasmBuilder {

Expression* makeSelect(Element& s, WasmType type) {
auto ret = allocator.alloc<Select>();
ret->condition = parseExpression(s[1]);
ret->ifTrue = parseExpression(s[2]);
ret->ifFalse = parseExpression(s[3]);
ret->ifTrue = parseExpression(s[1]);
ret->ifFalse = parseExpression(s[2]);
ret->condition = parseExpression(s[3]);
ret->type = type;
return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion src/wasm.h
Original file line number Diff line number Diff line change
Expand Up @@ -917,9 +917,9 @@ class Select : public Expression {
o << '(';
prepareColor(o) << printWasmType(type) << ".select";
incIndent(o, indent);
printFullLine(o, indent, condition);
printFullLine(o, indent, ifTrue);
printFullLine(o, indent, ifFalse);
printFullLine(o, indent, condition);
return decIndent(o, indent);
}

Expand Down
Loading