瀏覽代碼

Meta: Manually compute the length of the WASM JS REPL source string

The REPL does not have a reliable way to tell us the UTF-8 byte count of
the source string, so we must use strlen() ourselves.
Timothy Flynn 2 年之前
父節點
當前提交
d50b9165cd
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Meta/Lagom/Wasm/js_repl.cpp

+ 2 - 2
Meta/Lagom/Wasm/js_repl.cpp

@@ -386,7 +386,7 @@ extern "C" int initialize_repl(char const* time_zone)
     return 0;
 }
 
-extern "C" bool execute(char const* s, u32 length)
+extern "C" bool execute(char const* source)
 {
-    return parse_and_run(*g_interpreter, { s, length }, "REPL"sv);
+    return parse_and_run(*g_interpreter, { source, strlen(source) }, "REPL"sv);
 }