-
-
Notifications
You must be signed in to change notification settings - Fork 671
fix: Backport heroic fixes made in #1559 #1568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10508,8 +10508,12 @@ export class Compiler extends DiagnosticEmitter { | |
} | ||
} | ||
var parameterTypes = signature.parameterTypes; | ||
var parameterNodes = reportNode.parameters; | ||
for (let i = 0, k = parameterTypes.length; i < k; ++i) { | ||
if (!this.checkTypeSupported(parameterTypes[i], reportNode.parameters[i])) { | ||
let parameterReportNode: Node; | ||
if (parameterNodes.length > i) parameterReportNode = parameterNodes[i]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here, the function may come from a function expression with an omitted argument being compiled in context of a function type with fewer argument expressions, implicitly dropping excess arguments due to being irrelevant. Doesn't error when compiling to JS due to undefined, but produced a fine runtime index-out-of-bounds in Wasm. |
||
else parameterReportNode = reportNode; | ||
if (!this.checkTypeSupported(parameterTypes[i], parameterReportNode)) { | ||
supported = false; | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -612,7 +612,7 @@ export class Flow { | |
/** Tests if the specified `this` field has the specified flag or flags. */ | ||
isThisFieldFlag(field: Field, flag: FieldFlags): bool { | ||
var fieldFlags = this.thisFieldFlags; | ||
if (fieldFlags) { | ||
if (fieldFlags != null && fieldFlags.has(field)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is old code apparently, written before the requirement for a |
||
return (changetype<FieldFlags>(fieldFlags.get(field)) & flag) == flag; | ||
} | ||
return false; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ function i64_is<T>(value: T): bool { | |
// @ts-ignore: decorator | ||
@global @inline | ||
function i64_new(lo: i32, hi: i32 = 0): i64 { | ||
return lo | (hi << 32); | ||
return <i64><u32>lo | (<i64>hi << 32); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A spectacular piece of code that was completely wrong before, and looks absolutely bogus now. Apart from the missing cast to |
||
} | ||
|
||
// @ts-ignore: decorator | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4117,6 +4117,8 @@ export class Class extends TypedElement { | |
implementers: Set<Class> | null = null; | ||
/** Whether the field initialization check has already been performed. */ | ||
didCheckFieldInitialization: bool = false; | ||
/** Runtime visitor function reference. */ | ||
visitRef: FunctionRef = 0; | ||
|
||
/** Gets the unique runtime id of this class. */ | ||
get id(): u32 { | ||
|
@@ -4273,9 +4275,8 @@ export class Class extends TypedElement { | |
var instance: Class | null = this; | ||
do { | ||
let overloads = instance.overloads; | ||
if (overloads) { | ||
let overload = overloads.get(kind); | ||
if (overload) return overload; | ||
if (overloads != null && overloads.has(kind)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another fix within the |
||
return assert(overloads.get(kind)); | ||
} | ||
instance = instance.base; | ||
} while (instance); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -563,7 +563,7 @@ export class Array<T> { | |
|
||
// RT integration | ||
|
||
@unsafe private __visit_impl(cookie: u32): void { | ||
@unsafe private __visit(cookie: u32): void { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. |
||
if (isManaged<T>()) { | ||
let cur = this.dataStart; | ||
let end = cur + (<usize>this.length_ << alignof<T>()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A new runtime visitor implementation that generates per-class functions instead of a huge unwieldy switch. Increases binary size somewhat, but is much easier to reason about.