wabt
68fe76c6 - Delay validation of elem init expressions until validation time (#1730)

Commit
4 years ago
Delay validation of elem init expressions until validation time (#1730) Doing validation at parse time means we cannot run tests which included invalid instruction in the elem init expressions. For example. the updated test suite repo contains tests such as this: ``` (assert_invalid (module (table 1 funcref) (elem (i32.const 0) funcref (item (i32.add (i32.const 0) (i32.const 1)))) ) "constant expression required" ) ``` There we have an illegal instruction sequence in the init expresssion. However, in order to run this test we need to be able to process it with wast2json first which means it at least has to parse correctly. This change removes the `ElemExpr` and `ElemExprKind` types from the IR and instead just stores elem init expressions as `ExprList` like we do for global init expressions. This expression list can then be validated but crucially can also be invalid. This technique matches the existing `OnDataSegmentInitExpr_Other` and `OnGlobalInitExpr_Other` and indeed it seem that it was indented to work this way since the `OnElemSegmentElemExpr_Other` already existed (unused) in the codebase.
Author
Parents
Loading