@@ -358,8 +358,8 @@ export class Compiler extends DiagnosticEmitter {
358
358
skippedAutoreleases : Set < ExpressionRef > = new Set ( ) ;
359
359
/** Current inline functions stack. */
360
360
inlineStack : Function [ ] = [ ] ;
361
- /** Lazily compiled library functions. */
362
- lazyLibraryFunctions : Set < Function > = new Set ( ) ;
361
+ /** Lazily compiled functions. */
362
+ lazyFunctions : Set < Function > = new Set ( ) ;
363
363
/** Pending class-specific instanceof helpers. */
364
364
pendingClassInstanceOf : Set < ClassPrototype > = new Set ( ) ;
365
365
/** Functions potentially involving a virtual call. */
@@ -490,20 +490,20 @@ export class Compiler extends DiagnosticEmitter {
490
490
program . registerConstantInteger ( "__GC_ALL_ACYCLIC" , Type . bool , i64_new ( 1 , 0 ) ) ;
491
491
}
492
492
493
- // compile lazy library functions
494
- var lazyLibraryFunctions = this . lazyLibraryFunctions ;
493
+ // compile lazy functions
494
+ var lazyFunctions = this . lazyFunctions ;
495
495
do {
496
496
let functionsToCompile = new Array < Function > ( ) ;
497
497
// TODO: for (let instance of lazyLibraryFunctions) {
498
- for ( let _values = Set_values ( lazyLibraryFunctions ) , i = 0 , k = _values . length ; i < k ; ++ i ) {
498
+ for ( let _values = Set_values ( lazyFunctions ) , i = 0 , k = _values . length ; i < k ; ++ i ) {
499
499
let instance = unchecked ( _values [ i ] ) ;
500
500
functionsToCompile . push ( instance ) ;
501
501
}
502
- lazyLibraryFunctions . clear ( ) ;
502
+ lazyFunctions . clear ( ) ;
503
503
for ( let i = 0 , k = functionsToCompile . length ; i < k ; ++ i ) {
504
504
this . compileFunction ( unchecked ( functionsToCompile [ i ] ) , true ) ;
505
505
}
506
- } while ( lazyLibraryFunctions . size ) ;
506
+ } while ( lazyFunctions . size ) ;
507
507
508
508
// compile pending class-specific instanceof helpers
509
509
// TODO: for (let prototype of this.pendingClassInstanceOf.values()) {
@@ -759,7 +759,7 @@ export class Compiler extends DiagnosticEmitter {
759
759
global . identifierNode . range
760
760
) ;
761
761
} else {
762
- this . module . addGlobalExport ( element . internalName , prefix + name ) ;
762
+ if ( element . is ( CommonFlags . COMPILED ) ) this . module . addGlobalExport ( element . internalName , prefix + name ) ;
763
763
}
764
764
break ;
765
765
}
@@ -916,7 +916,7 @@ export class Compiler extends DiagnosticEmitter {
916
916
// TODO: for (let element of exports.values()) {
917
917
for ( let _values = Map_values ( exports ) , i = 0 , k = _values . length ; i < k ; ++ i ) {
918
918
let element = unchecked ( _values [ i ] ) ;
919
- this . compileElement ( element ) ;
919
+ if ( ! element . hasDecorator ( DecoratorFlags . LAZY ) ) this . compileElement ( element ) ;
920
920
}
921
921
}
922
922
var exportsStar = file . exportsStar ;
@@ -1349,7 +1349,7 @@ export class Compiler extends DiagnosticEmitter {
1349
1349
if ( ! forceStdAlternative ) {
1350
1350
if ( instance . hasDecorator ( DecoratorFlags . BUILTIN ) ) return true ;
1351
1351
if ( instance . hasDecorator ( DecoratorFlags . LAZY ) ) {
1352
- this . lazyLibraryFunctions . add ( instance ) ;
1352
+ this . lazyFunctions . add ( instance ) ;
1353
1353
return true ;
1354
1354
}
1355
1355
}
0 commit comments