File tree Expand file tree Collapse file tree 4 files changed +19
-9
lines changed Expand file tree Collapse file tree 4 files changed +19
-9
lines changed Original file line number Diff line number Diff line change @@ -10329,17 +10329,17 @@ export function compileVisitMembers(compiler: Compiler): void {
10329
10329
let instanceId = _keys [ i ] ;
10330
10330
assert ( instanceId == nextId ++ ) ;
10331
10331
let instance = assert ( managedClasses . get ( instanceId ) ) ;
10332
- names [ i ] = instance . internalName ;
10332
+ names . push ( instance . internalName ) ;
10333
10333
if ( instance . isPointerfree ) {
10334
- cases [ i ] = module . return ( ) ;
10334
+ cases . push ( module . return ( ) ) ;
10335
10335
} else {
10336
- cases [ i ] = module . block ( null , [
10336
+ cases . push ( module . block ( null , [
10337
10337
module . call ( `${ instance . internalName } ~visit` , [
10338
10338
module . local_get ( 0 , sizeTypeRef ) , // this
10339
10339
module . local_get ( 1 , TypeRef . I32 ) // cookie
10340
10340
] , TypeRef . None ) ,
10341
10341
module . return ( )
10342
- ] , TypeRef . None ) ;
10342
+ ] , TypeRef . None ) ) ;
10343
10343
ensureVisitMembersOf ( compiler , instance ) ;
10344
10344
}
10345
10345
}
Original file line number Diff line number Diff line change @@ -6379,7 +6379,7 @@ export class Compiler extends DiagnosticEmitter {
6379
6379
}
6380
6380
let numOptional = assert ( maxOperands - minOperands ) ;
6381
6381
6382
- let forwardedOperands = new Array < ExpressionRef > ( minOperands ) ;
6382
+ let forwardedOperands = new Array < ExpressionRef > ( maxOperands ) ;
6383
6383
let operandIndex = 0 ;
6384
6384
let stmts = new Array < ExpressionRef > ( ) ;
6385
6385
@@ -6609,7 +6609,7 @@ export class Compiler extends DiagnosticEmitter {
6609
6609
let body : ExpressionRef ;
6610
6610
let instanceClass = instance . getBoundClassOrInterface ( ) ;
6611
6611
if ( ! instance . is ( CommonFlags . Abstract ) && ! ( instanceClass && instanceClass . kind == ElementKind . Interface ) ) {
6612
- let paramExprs = new Array < ExpressionRef > ( numParameters ) ;
6612
+ let paramExprs = new Array < ExpressionRef > ( numParameters + 1 ) ;
6613
6613
paramExprs [ 0 ] = module . local_get ( 0 , sizeTypeRef ) ; // this
6614
6614
for ( let i = 0 , k = parameterTypes . length ; i < k ; ++ i ) {
6615
6615
paramExprs [ 1 + i ] = module . local_get ( 1 + i , parameterTypes [ i ] . toRef ( ) ) ;
Original file line number Diff line number Diff line change @@ -524,15 +524,25 @@ export class Flow {
524
524
setLocalFlag ( index : i32 , flag : LocalFlags ) : void {
525
525
if ( index < 0 ) return ;
526
526
let localFlags = this . localFlags ;
527
- let flags = index < localFlags . length ? unchecked ( localFlags [ index ] ) : 0 ;
527
+ let flags = 0 ;
528
+ if ( index < localFlags . length ) {
529
+ flags = unchecked ( localFlags [ index ] ) ;
530
+ } else {
531
+ localFlags . length = index + 1 ;
532
+ }
528
533
localFlags [ index ] = flags | flag ;
529
534
}
530
535
531
536
/** Unsets the specified flag or flags on the local at the specified index. */
532
537
unsetLocalFlag ( index : i32 , flag : LocalFlags ) : void {
533
538
if ( index < 0 ) return ;
534
539
let localFlags = this . localFlags ;
535
- let flags = index < localFlags . length ? unchecked ( localFlags [ index ] ) : 0 ;
540
+ let flags = 0 ;
541
+ if ( index < localFlags . length ) {
542
+ flags = unchecked ( localFlags [ index ] ) ;
543
+ } else {
544
+ localFlags . length = index + 1 ;
545
+ }
536
546
localFlags [ index ] = flags & ~ flag ;
537
547
}
538
548
Original file line number Diff line number Diff line change @@ -467,7 +467,7 @@ export class ShadowStackPass extends Pass {
467
467
let results = _BinaryenFunctionGetResults ( funcRef ) ;
468
468
let body = assert ( _BinaryenFunctionGetBody ( funcRef ) ) ;
469
469
let numVars = _BinaryenFunctionGetNumVars ( funcRef ) ;
470
- let vars = new Array < TypeRef > ( ) ;
470
+ let vars = new Array < TypeRef > ( numVars ) ;
471
471
for ( let i : Index = 0 ; i < numVars ; ++ i ) {
472
472
vars [ i ] = _BinaryenFunctionGetVar ( funcRef , i ) ;
473
473
}
You can’t perform that action at this time.
0 commit comments