Add ArrayBuffer.isView and rework Array.isArray (#431)

This commit is contained in:
Max Graey
2019-02-03 11:41:04 +02:00
committed by Daniel Wirtz
parent 1867416236
commit 4829f3a3e4
18 changed files with 3530 additions and 2567 deletions

View File

@@ -2856,6 +2856,14 @@ export class ClassPrototype extends Element {
this.decoratorFlags = decoratorFlags;
}
extends(basePtototype: ClassPrototype | null): bool {
var current: ClassPrototype | null = this;
do {
if (current === basePtototype) return true;
} while (current = current.basePrototype);
return false;
}
toString(): string {
return this.simpleName;
}
@@ -2969,6 +2977,16 @@ export class Class extends Element {
return null;
}
lookupField(name: string, shouldReadonly: boolean = false): Element | null {
if (this.members == null) return null;
var member = this.members.get(name);
if (
member == null || member.kind != ElementKind.FIELD ||
(shouldReadonly && !member.is(CommonFlags.READONLY))
) return null;
return member;
}
offsetof(fieldName: string): u32 {
var members = assert(this.members);
assert(members.has(fieldName));