mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-11-28 23:14:12 +03:00
uses (JS) const
for stack and slab declarations (#415)
This commit is contained in:
parent
791e69a5c0
commit
d179503a63
@ -766,7 +766,7 @@ impl<'a> Context<'a> {
|
||||
}
|
||||
self.global(&format!(
|
||||
"
|
||||
let stack = [];
|
||||
const stack = [];
|
||||
"
|
||||
));
|
||||
if self.config.debug {
|
||||
@ -793,7 +793,7 @@ impl<'a> Context<'a> {
|
||||
"{ obj: true }",
|
||||
"{ obj: false }",
|
||||
];
|
||||
self.global(&format!("let slab = [{}];", initial_values.join(", ")));
|
||||
self.global(&format!("const slab = [{}];", initial_values.join(", ")));
|
||||
if self.config.debug {
|
||||
self.export(
|
||||
"assertSlabEmpty",
|
||||
|
@ -47,7 +47,7 @@ and what we actually generate looks something like:
|
||||
// foo.js
|
||||
import * as wasm from './foo_bg';
|
||||
|
||||
let stack = [];
|
||||
const stack = [];
|
||||
|
||||
function addBorrowedObject(obj) {
|
||||
stack.push(obj);
|
||||
@ -135,7 +135,7 @@ different. Let's see the generated JS's slab in action:
|
||||
```js
|
||||
import * as wasm from './foo_bg'; // imports from wasm file
|
||||
|
||||
let slab = [];
|
||||
const slab = [];
|
||||
let slab_next = 0;
|
||||
|
||||
function addHeapObject(obj) {
|
||||
|
Loading…
Reference in New Issue
Block a user