mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-13 23:11:41 +00:00
Update binary expression inference, see #35; Update dependencies
This commit is contained in:
@ -41,7 +41,7 @@ export class Array<T> {
|
||||
|
||||
@operator("[]")
|
||||
private __get(index: i32): T {
|
||||
if (<u32>index >= this.__capacity) {
|
||||
if (<u32>index >= <u32>this.__capacity) {
|
||||
throw new Error("Index out of bounds"); // return changetype<T>(0) ?
|
||||
}
|
||||
return load<T>(this.__memory + <usize>index * sizeof<T>());
|
||||
@ -62,7 +62,7 @@ export class Array<T> {
|
||||
if (fromIndex < 0) {
|
||||
fromIndex = this.__length + fromIndex;
|
||||
}
|
||||
while (<u32>fromIndex < this.__length) {
|
||||
while (<u32>fromIndex < <u32>this.__length) {
|
||||
if (load<T>(this.__memory + <usize>fromIndex * sizeof<T>()) == searchElement) {
|
||||
return fromIndex;
|
||||
}
|
||||
|
@ -185,8 +185,8 @@ export { usize };
|
||||
@builtin
|
||||
declare function bool(value: void): bool;
|
||||
namespace bool {
|
||||
export const MIN_VALUE: bool = 0;
|
||||
export const MAX_VALUE: bool = 1;
|
||||
export const MIN_VALUE: bool = false;
|
||||
export const MAX_VALUE: bool = true;
|
||||
}
|
||||
export { bool };
|
||||
|
||||
|
@ -13,13 +13,13 @@ function allocate(length: i32): String {
|
||||
|
||||
export class String {
|
||||
|
||||
readonly length: i32;
|
||||
readonly length: i32; // capped to [0, 0x7fffffff]
|
||||
|
||||
@operator("[]")
|
||||
charAt(pos: i32): String {
|
||||
assert(this != null);
|
||||
|
||||
if (<u32>pos >= this.length) {
|
||||
if (<u32>pos >= <u32>this.length) {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ export class String {
|
||||
|
||||
charCodeAt(pos: i32): i32 {
|
||||
assert(this != null);
|
||||
if (<u32>pos >= this.length) {
|
||||
if (<u32>pos >= <u32>this.length) {
|
||||
return -1; // (NaN)
|
||||
}
|
||||
return load<u16>(
|
||||
@ -48,7 +48,7 @@ export class String {
|
||||
|
||||
codePointAt(pos: i32): i32 {
|
||||
assert(this != null);
|
||||
if (<u32>pos >= this.length) {
|
||||
if (<u32>pos >= <u32>this.length) {
|
||||
return -1; // (undefined)
|
||||
}
|
||||
var first = <i32>load<u16>(
|
||||
|
Reference in New Issue
Block a user