Browse Source

Merge pull request #42 from bidhan-a/fix/wasm-targets

fix wasm target
Claire Fan 1 month ago
parent
commit
d82ee4cd34

+ 3 - 3
crates/assembler/src/wasm.rs

@@ -3,7 +3,7 @@ use serde::Serialize;
 use serde_wasm_bindgen::to_value;
 use serde_wasm_bindgen::to_value;
 use std::ops::Range;
 use std::ops::Range;
 use crate::lexer::tokenize;
 use crate::lexer::tokenize;
-use crate::parser::Parser;
+use crate::parser::parse_tokens;
 use crate::program::Program;
 use crate::program::Program;
 
 
 #[derive(Serialize)]
 #[derive(Serialize)]
@@ -51,8 +51,8 @@ pub fn assemble(source: &str) -> Result<Vec<u8>, JsValue> {
             return Err(to_value(&compile_errors).unwrap());
             return Err(to_value(&compile_errors).unwrap());
         }
         }
     };
     };
-    let mut parser = Parser::new(tokens);
-    let parse_result = match parser.parse() {
+
+    let parse_result = match parse_tokens(&tokens) {
         Ok(program) => program,
         Ok(program) => program,
         Err(errors) => {
         Err(errors) => {
             let compile_errors : Vec<CompileErrorInfo> = errors.iter().map(|e| {
             let compile_errors : Vec<CompileErrorInfo> = errors.iter().map(|e| {

+ 13 - 14
dist/bundler/sbpf_assembler_bg.js

@@ -194,12 +194,12 @@ export function assemble(source) {
     return v2;
     return v2;
 }
 }
 
 
-export function __wbg_new_1930cbb8d9ffc31b() {
+export function __wbg_new_07b483f72211fd66() {
     const ret = new Object();
     const ret = new Object();
     return ret;
     return ret;
 };
 };
 
 
-export function __wbg_new_e969dc3f68d25093() {
+export function __wbg_new_58353953ad2097cc() {
     const ret = new Array();
     const ret = new Array();
     return ret;
     return ret;
 };
 };
@@ -208,11 +208,11 @@ export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
     arg0[arg1] = arg2;
     arg0[arg1] = arg2;
 };
 };
 
 
-export function __wbg_set_d636a0463acf1dbc(arg0, arg1, arg2) {
+export function __wbg_set_7422acbe992d64ab(arg0, arg1, arg2) {
     arg0[arg1 >>> 0] = arg2;
     arg0[arg1 >>> 0] = arg2;
 };
 };
 
 
-export function __wbg_wbindgendebugstring_bb652b1bc2061b6d(arg0, arg1) {
+export function __wbindgen_debug_string(arg0, arg1) {
     const ret = debugString(arg1);
     const ret = debugString(arg1);
     const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
     const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
     const len1 = WASM_VECTOR_LEN;
     const len1 = WASM_VECTOR_LEN;
@@ -220,16 +220,6 @@ export function __wbg_wbindgendebugstring_bb652b1bc2061b6d(arg0, arg1) {
     getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
     getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
 };
 };
 
 
-export function __wbg_wbindgenthrow_4c11a24fca429ccf(arg0, arg1) {
-    throw new Error(getStringFromWasm0(arg0, arg1));
-};
-
-export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
-    // Cast intrinsic for `Ref(String) -> Externref`.
-    const ret = getStringFromWasm0(arg0, arg1);
-    return ret;
-};
-
 export function __wbindgen_init_externref_table() {
 export function __wbindgen_init_externref_table() {
     const table = wasm.__wbindgen_export_2;
     const table = wasm.__wbindgen_export_2;
     const offset = table.grow(4);
     const offset = table.grow(4);
@@ -241,3 +231,12 @@ export function __wbindgen_init_externref_table() {
     ;
     ;
 };
 };
 
 
+export function __wbindgen_string_new(arg0, arg1) {
+    const ret = getStringFromWasm0(arg0, arg1);
+    return ret;
+};
+
+export function __wbindgen_throw(arg0, arg1) {
+    throw new Error(getStringFromWasm0(arg0, arg1));
+};
+

BIN
dist/bundler/sbpf_assembler_bg.wasm


+ 13 - 14
dist/node/sbpf_assembler.js

@@ -182,12 +182,12 @@ module.exports.assemble = function(source) {
     return v2;
     return v2;
 };
 };
 
 
-module.exports.__wbg_new_1930cbb8d9ffc31b = function() {
+module.exports.__wbg_new_07b483f72211fd66 = function() {
     const ret = new Object();
     const ret = new Object();
     return ret;
     return ret;
 };
 };
 
 
-module.exports.__wbg_new_e969dc3f68d25093 = function() {
+module.exports.__wbg_new_58353953ad2097cc = function() {
     const ret = new Array();
     const ret = new Array();
     return ret;
     return ret;
 };
 };
@@ -196,11 +196,11 @@ module.exports.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
     arg0[arg1] = arg2;
     arg0[arg1] = arg2;
 };
 };
 
 
-module.exports.__wbg_set_d636a0463acf1dbc = function(arg0, arg1, arg2) {
+module.exports.__wbg_set_7422acbe992d64ab = function(arg0, arg1, arg2) {
     arg0[arg1 >>> 0] = arg2;
     arg0[arg1 >>> 0] = arg2;
 };
 };
 
 
-module.exports.__wbg_wbindgendebugstring_bb652b1bc2061b6d = function(arg0, arg1) {
+module.exports.__wbindgen_debug_string = function(arg0, arg1) {
     const ret = debugString(arg1);
     const ret = debugString(arg1);
     const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
     const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
     const len1 = WASM_VECTOR_LEN;
     const len1 = WASM_VECTOR_LEN;
@@ -208,16 +208,6 @@ module.exports.__wbg_wbindgendebugstring_bb652b1bc2061b6d = function(arg0, arg1)
     getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
     getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
 };
 };
 
 
-module.exports.__wbg_wbindgenthrow_4c11a24fca429ccf = function(arg0, arg1) {
-    throw new Error(getStringFromWasm0(arg0, arg1));
-};
-
-module.exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
-    // Cast intrinsic for `Ref(String) -> Externref`.
-    const ret = getStringFromWasm0(arg0, arg1);
-    return ret;
-};
-
 module.exports.__wbindgen_init_externref_table = function() {
 module.exports.__wbindgen_init_externref_table = function() {
     const table = wasm.__wbindgen_export_2;
     const table = wasm.__wbindgen_export_2;
     const offset = table.grow(4);
     const offset = table.grow(4);
@@ -229,6 +219,15 @@ module.exports.__wbindgen_init_externref_table = function() {
     ;
     ;
 };
 };
 
 
+module.exports.__wbindgen_string_new = function(arg0, arg1) {
+    const ret = getStringFromWasm0(arg0, arg1);
+    return ret;
+};
+
+module.exports.__wbindgen_throw = function(arg0, arg1) {
+    throw new Error(getStringFromWasm0(arg0, arg1));
+};
+
 const path = require('path').join(__dirname, 'sbpf_assembler_bg.wasm');
 const path = require('path').join(__dirname, 'sbpf_assembler_bg.wasm');
 const bytes = require('fs').readFileSync(path);
 const bytes = require('fs').readFileSync(path);
 
 

BIN
dist/node/sbpf_assembler_bg.wasm


+ 11 - 12
dist/web/sbpf_assembler.js

@@ -224,35 +224,27 @@ async function __wbg_load(module, imports) {
 function __wbg_get_imports() {
 function __wbg_get_imports() {
     const imports = {};
     const imports = {};
     imports.wbg = {};
     imports.wbg = {};
-    imports.wbg.__wbg_new_1930cbb8d9ffc31b = function() {
+    imports.wbg.__wbg_new_07b483f72211fd66 = function() {
         const ret = new Object();
         const ret = new Object();
         return ret;
         return ret;
     };
     };
-    imports.wbg.__wbg_new_e969dc3f68d25093 = function() {
+    imports.wbg.__wbg_new_58353953ad2097cc = function() {
         const ret = new Array();
         const ret = new Array();
         return ret;
         return ret;
     };
     };
     imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
     imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
         arg0[arg1] = arg2;
         arg0[arg1] = arg2;
     };
     };
-    imports.wbg.__wbg_set_d636a0463acf1dbc = function(arg0, arg1, arg2) {
+    imports.wbg.__wbg_set_7422acbe992d64ab = function(arg0, arg1, arg2) {
         arg0[arg1 >>> 0] = arg2;
         arg0[arg1 >>> 0] = arg2;
     };
     };
-    imports.wbg.__wbg_wbindgendebugstring_bb652b1bc2061b6d = function(arg0, arg1) {
+    imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
         const ret = debugString(arg1);
         const ret = debugString(arg1);
         const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
         const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
         const len1 = WASM_VECTOR_LEN;
         const len1 = WASM_VECTOR_LEN;
         getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
         getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
         getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
         getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
     };
     };
-    imports.wbg.__wbg_wbindgenthrow_4c11a24fca429ccf = function(arg0, arg1) {
-        throw new Error(getStringFromWasm0(arg0, arg1));
-    };
-    imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
-        // Cast intrinsic for `Ref(String) -> Externref`.
-        const ret = getStringFromWasm0(arg0, arg1);
-        return ret;
-    };
     imports.wbg.__wbindgen_init_externref_table = function() {
     imports.wbg.__wbindgen_init_externref_table = function() {
         const table = wasm.__wbindgen_export_2;
         const table = wasm.__wbindgen_export_2;
         const offset = table.grow(4);
         const offset = table.grow(4);
@@ -263,6 +255,13 @@ function __wbg_get_imports() {
         table.set(offset + 3, false);
         table.set(offset + 3, false);
         ;
         ;
     };
     };
+    imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
+        const ret = getStringFromWasm0(arg0, arg1);
+        return ret;
+    };
+    imports.wbg.__wbindgen_throw = function(arg0, arg1) {
+        throw new Error(getStringFromWasm0(arg0, arg1));
+    };
 
 
     return imports;
     return imports;
 }
 }

BIN
dist/web/sbpf_assembler_bg.wasm