uses (JS) const for stack and slab declarations (#415)

This commit is contained in:
Marcin Baraniecki 2018-07-07 20:36:05 +02:00 committed by Alex Crichton
parent 791e69a5c0
commit d179503a63
2 changed files with 4 additions and 4 deletions

View File

@ -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",

View File

@ -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) {