Skip to content

Commit 6f7e7f5

Browse files
committed
WASM: Support visit_StringLen()
1 parent 1180f99 commit 6f7e7f5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/libasr/codegen/asr_to_wasm.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1935,6 +1935,15 @@ class ASRToWASMVisitor : public ASR::BaseVisitor<ASRToWASMVisitor> {
19351935
throw CodeGenError("String Types not yet supported");
19361936
}
19371937

1938+
void visit_StringLen(const ASR::StringLen_t & x) {
1939+
if (x.m_value) {
1940+
visit_expr(*x.m_value);
1941+
return;
1942+
}
1943+
this->visit_expr(*x.m_arg);
1944+
m_wa.emit_i32_load(wasm::mem_align::b8, 4);
1945+
}
1946+
19381947
void visit_LogicalBinOp(const ASR::LogicalBinOp_t &x) {
19391948
if (x.m_value) {
19401949
visit_expr(*x.m_value);

0 commit comments

Comments
 (0)