ballercat / walt

:zap: Walt is a JavaScript-like syntax for WebAssembly text format :zap:

Home Page:https://ballercat.github.io/walt/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support `else if (...)`

ballercat opened this issue · comments

Overview

The lack of else if is awkward, makes it difficult to write some code.

A quick solution might be to encode the node as a literal else block containing a single if.

Sample spec

export function test(x: i32): i32 {
   if (x == 0) {
     return 2;
  } else if (x == 1) {
     return 4;
  } else {
     return -1;
  }
}

That should do it.

  • Tests
  • Tests pass