22import * as ts from "typescript" ;
33import * as llvm from "llvm-node" ;
44import { Scope } from "./scope" ;
5+ import { ArrayLiteralExpressionCodeGenerator } from "./code-generation/array-literal-expression" ;
56
67export class SignatureToFunctionTable extends Map < ts . Signature , llvm . Function > {
78
@@ -20,5 +21,53 @@ export class Context {
2021 this . typeChecker = typeChecker ;
2122 this . llvmContext = new llvm . LLVMContext ( ) ;
2223 this . llvmModule = new llvm . Module ( "test" , this . llvmContext ) ;
24+
25+ this . scope . classes . set ( 'Uint8Array' , ArrayLiteralExpressionCodeGenerator . buildTypedArrayStructLLVMType (
26+ llvm . Type . getInt8Ty ( this . llvmContext ) ,
27+ this ,
28+ 'array<uint8>'
29+ ) ) ;
30+
31+ this . scope . classes . set ( 'Int8Array' , ArrayLiteralExpressionCodeGenerator . buildTypedArrayStructLLVMType (
32+ llvm . Type . getInt8Ty ( this . llvmContext ) ,
33+ this ,
34+ 'array<int8>'
35+ ) ) ;
36+
37+ this . scope . classes . set ( 'Int16Array' , ArrayLiteralExpressionCodeGenerator . buildTypedArrayStructLLVMType (
38+ llvm . Type . getInt16Ty ( this . llvmContext ) ,
39+ this ,
40+ 'array<int16>'
41+ ) ) ;
42+
43+ this . scope . classes . set ( 'Uint16Array' , ArrayLiteralExpressionCodeGenerator . buildTypedArrayStructLLVMType (
44+ llvm . Type . getInt16Ty ( this . llvmContext ) ,
45+ this ,
46+ 'array<uint16>'
47+ ) ) ;
48+
49+ this . scope . classes . set ( 'Int32Array' , ArrayLiteralExpressionCodeGenerator . buildTypedArrayStructLLVMType (
50+ llvm . Type . getInt32Ty ( this . llvmContext ) ,
51+ this ,
52+ 'array<int32>'
53+ ) ) ;
54+
55+ this . scope . classes . set ( 'Uint32Array' , ArrayLiteralExpressionCodeGenerator . buildTypedArrayStructLLVMType (
56+ llvm . Type . getInt32Ty ( this . llvmContext ) ,
57+ this ,
58+ 'array<uint32>'
59+ ) ) ;
60+
61+ this . scope . classes . set ( 'Float32Array' , ArrayLiteralExpressionCodeGenerator . buildTypedArrayStructLLVMType (
62+ llvm . Type . getFloatTy ( this . llvmContext ) ,
63+ this ,
64+ 'array<float32>'
65+ ) ) ;
66+
67+ this . scope . classes . set ( 'Float64Array' , ArrayLiteralExpressionCodeGenerator . buildTypedArrayStructLLVMType (
68+ llvm . Type . getDoubleTy ( this . llvmContext ) ,
69+ this ,
70+ 'array<float64>'
71+ ) ) ;
2372 }
2473}
0 commit comments