Browse Source

* use a_throw instead of a_legacy_throw in twasminlinenode.second_throw_fpcexception, unless legacy exceptions mode is selected

Nikolay Nikolov 1 day ago
parent
commit
4801ddaf0a
1 changed files with 4 additions and 1 deletions
  1. 4 1
      compiler/wasm32/nwasminl.pas

+ 4 - 1
compiler/wasm32/nwasminl.pas

@@ -440,7 +440,10 @@ implementation
     procedure twasminlinenode.second_throw_fpcexception;
       begin
         location_reset(location,LOC_VOID,OS_NO);
-        current_asmdata.CurrAsmList.Concat(taicpu.op_sym(a_legacy_throw,current_asmdata.WeakRefAsmSymbol(FPC_EXCEPTION_TAG_SYM,AT_WASM_EXCEPTION_TAG)));
+        if ts_wasm_native_legacy_exceptions in current_settings.targetswitches then
+          current_asmdata.CurrAsmList.Concat(taicpu.op_sym(a_legacy_throw,current_asmdata.WeakRefAsmSymbol(FPC_EXCEPTION_TAG_SYM,AT_WASM_EXCEPTION_TAG)))
+        else
+          current_asmdata.CurrAsmList.Concat(taicpu.op_sym(a_throw,current_asmdata.WeakRefAsmSymbol(FPC_EXCEPTION_TAG_SYM,AT_WASM_EXCEPTION_TAG)));
       end;