@@ -1090,7 +1090,7 @@ export class LLVMGenerator extends BaseGenerator implements IGeneratorContext {
10901090 }
10911091 public setOutputLine ( index : number , line : string ) : void {
10921092 const newOutput : string [ ] = [ ] ;
1093- const newIsTerminator : boolean [ ] = [ ] ;
1093+ const newIsTerminator : number [ ] = [ ] ;
10941094 for ( let i = 0 ; i < this . output . length ; i ++ ) {
10951095 if ( i === index ) {
10961096 newOutput . push ( line ) ;
@@ -2213,7 +2213,8 @@ export class LLVMGenerator extends BaseGenerator implements IGeneratorContext {
22132213 isString = base === "string" && depth === 0 ;
22142214 isStringArray = base === "string" && depth > 0 ;
22152215 isObjectArray = depth > 0 && base !== "string" && base !== "number" && base !== "boolean" ;
2216- isArray = depth > 0 && ( base === "number" || base === "boolean" ) ;
2216+ isArray = depth > 0 && base === "number" ;
2217+ if ( depth > 0 && base === "boolean" ) isUint8Array = true ;
22172218 isMap = base === "Map" || base . startsWith ( "Map<" ) ;
22182219 isSet = base === "Set" || base . startsWith ( "Set<" ) ;
22192220 isRegex = base === "RegExp" ;
@@ -2268,6 +2269,10 @@ export class LLVMGenerator extends BaseGenerator implements IGeneratorContext {
22682269 isUint8Array = true ;
22692270 isString = false ;
22702271 }
2272+ if ( ! isUint8Array && stmt . declaredType === "boolean[]" ) {
2273+ isUint8Array = true ;
2274+ isArray = false ;
2275+ }
22712276 if (
22722277 ! isClassInstance &&
22732278 stmt . value &&
@@ -2420,6 +2425,14 @@ export class LLVMGenerator extends BaseGenerator implements IGeneratorContext {
24202425 this . symbolTable . setResolvedType ( name , parseTypeString ( stmt . declaredType ) ) ;
24212426 }
24222427 continue ;
2428+ } else if ( isUint8Array ) {
2429+ llvmType = "%Uint8Array*" ;
2430+ kind = SymbolKind_Uint8Array ;
2431+ defaultValue = "null" ;
2432+ ir += `@${ name } = global ${ llvmType } ${ defaultValue } ` + "\n" ;
2433+ this . globalVariables . set ( name , { llvmType, kind, initialized : false } ) ;
2434+ this . defineVariable ( name , `@${ name } ` , llvmType , kind , "global" ) ;
2435+ continue ;
24232436 } else if ( isArray ) {
24242437 llvmType = "%Array*" ;
24252438 kind = SymbolKind_Array ;
@@ -2591,14 +2604,6 @@ export class LLVMGenerator extends BaseGenerator implements IGeneratorContext {
25912604 llvmType = "i8*" ;
25922605 kind = SymbolKind_Regex ;
25932606 defaultValue = "null" ;
2594- } else if ( isUint8Array ) {
2595- llvmType = "%Uint8Array*" ;
2596- kind = SymbolKind_Uint8Array ;
2597- defaultValue = "null" ;
2598- ir += `@${ name } = global ${ llvmType } ${ defaultValue } ` + "\n" ;
2599- this . globalVariables . set ( name , { llvmType, kind, initialized : false } ) ;
2600- this . defineVariable ( name , `@${ name } ` , llvmType , kind , "global" ) ;
2601- continue ;
26022607 } else if ( isClassInstance ) {
26032608 let className = "" ;
26042609 const stmtValueType = ( stmt . value as { type : string } ) . type ;
@@ -2669,10 +2674,10 @@ export class LLVMGenerator extends BaseGenerator implements IGeneratorContext {
26692674 defaultValue = "0.0" ;
26702675 } else if ( strippedDeclaredType === "string[]" ) {
26712676 isStringArray = true ;
2672- } else if (
2673- strippedDeclaredType === "number[]" ||
2674- strippedDeclaredType === "boolean[]"
2675- ) {
2677+ } else if ( strippedDeclaredType === "boolean[]" ) {
2678+ isUint8Array = true ;
2679+ isArray = false ;
2680+ } else if ( strippedDeclaredType === "number[]" ) {
26762681 isArray = true ;
26772682 } else if ( strippedDeclaredType . endsWith ( "[]" ) ) {
26782683 isObjectArray = true ;
@@ -2781,7 +2786,16 @@ export class LLVMGenerator extends BaseGenerator implements IGeneratorContext {
27812786 this . defineVariable ( name , `@${ name } ` , "%StringArray*" , SymbolKind_StringArray , "global" ) ;
27822787 return `@${ name } = global %StringArray* null\n` ;
27832788 }
2784- if ( baseType === "number[]" || baseType === "boolean[]" ) {
2789+ if ( baseType === "boolean[]" ) {
2790+ this . globalVariables . set ( name , {
2791+ llvmType : "%Uint8Array*" ,
2792+ kind : SymbolKind_Uint8Array ,
2793+ initialized : false ,
2794+ } ) ;
2795+ this . defineVariable ( name , `@${ name } ` , "%Uint8Array*" , SymbolKind_Uint8Array , "global" ) ;
2796+ return `@${ name } = global %Uint8Array* null\n` ;
2797+ }
2798+ if ( baseType === "number[]" ) {
27852799 this . globalVariables . set ( name , {
27862800 llvmType : "%Array*" ,
27872801 kind : SymbolKind_Array ,
0 commit comments