Skip to content

Commit

Permalink
revert AssemblyScript#1353: revert runtime type check to compile time…
Browse files Browse the repository at this point in the history
… check
  • Loading branch information
HerrCai0907 committed Aug 7, 2022
1 parent 24a908d commit 541e80e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 2 additions & 2 deletions std/assembly/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { COMPARATOR, SORT } from "./util/sort";
import { REVERSE } from "./util/bytes";
import { joinBooleanArray, joinIntegerArray, joinFloatArray, joinStringArray, joinReferenceArray } from "./util/string";
import { idof, isArray as builtin_isArray } from "./builtins";
import { E_INDEXOUTOFRANGE, E_INVALIDLENGTH, E_ILLEGALGENTYPE, E_EMPTYARRAY, E_HOLEYARRAY } from "./util/error";
import { E_INDEXOUTOFRANGE, E_INVALIDLENGTH, E_EMPTYARRAY, E_HOLEYARRAY } from "./util/error";

// @ts-ignore: decorator
@inline @lazy const MIN_SIZE: usize = 8;
Expand Down Expand Up @@ -494,7 +494,7 @@ export class Array<T> {

flat(): T {
if (!isArray<T>()) {
throw new TypeError(E_ILLEGALGENTYPE);
ERROR("Cannot call flat() on Array<T> where T is not an Array.");
}
// Get the length and data start values
var ptr = this.dataStart;
Expand Down
4 changes: 0 additions & 4 deletions std/assembly/util/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ export const E_VALUEOUTOFRANGE: string = "Value out of range";
@lazy @inline
export const E_INVALIDLENGTH: string = "Invalid length";

// @ts-ignore: decorator
@lazy @inline
export const E_ILLEGALGENTYPE: string = "Illegal generic type";

// @ts-ignore: decorator
@lazy @inline
export const E_EMPTYARRAY: string = "Array is empty";
Expand Down

0 comments on commit 541e80e

Please sign in to comment.