Ensure consistent variable modifiers

'var' is a distinct local or mutable global, 'let' a shared local
This commit is contained in:
dcodeIO
2018-03-13 02:32:10 +01:00
parent 7ee6e1cf7b
commit 23a7db4dc3
33 changed files with 736 additions and 570 deletions

View File

@ -124,9 +124,9 @@ export class Array<T> {
var oldCapacity = this.__capacity;
if (this.__length == oldCapacity) {
// inlined __grow (avoids moving twice)
var newCapacity: i32 = oldCapacity ? oldCapacity << 1 : 1;
let newCapacity: i32 = oldCapacity ? oldCapacity << 1 : 1;
assert(newCapacity > this.__capacity);
var newMemory = allocate_memory(<usize>newCapacity * sizeof<T>());
let newMemory = allocate_memory(<usize>newCapacity * sizeof<T>());
if (this.__memory) {
move_memory(
newMemory + sizeof<T>(),
@ -202,8 +202,8 @@ export class Array<T> {
}
reverse(): Array<T> {
for (var front: usize = 0, back: usize = <usize>this.__length - 1; front < back; ++front, --back) {
var temp = load<T>(this.__memory + front * sizeof<T>());
for (let front: usize = 0, back: usize = <usize>this.__length - 1; front < back; ++front, --back) {
let temp = load<T>(this.__memory + front * sizeof<T>());
store<T>(this.__memory + front * sizeof<T>(), load<T>(this.__memory + back * sizeof<T>()));
store<T>(this.__memory + back * sizeof<T>(), temp);
}