@@ -35,6 +35,7 @@ import {PropertyAccessExpressionCodeGenerator} from "./code-generation/property-
3535import { TryStatementGenerator } from "./code-generation/try-statement" ;
3636import { PostfixUnaryExpressionCodeGenerator } from "./code-generation/postfix-unary-expression" ;
3737import { FunctionDeclarationCodeGenerator } from "./code-generation/function-declaration" ;
38+ import { TypeOfExpressionCodeGenerator } from "./code-generation/typeof-expression" ;
3839
3940export function emitCondition (
4041 condition : ts . Expression ,
@@ -49,15 +50,17 @@ export function emitCondition(
4950 builder . createCondBr ( conditionBoolValue . getValue ( ) , positiveBlock , negativeBlock ) ;
5051}
5152
52- export function buildFromStringValue ( node : ts . StringLiteral , ctx : Context , builder : llvm . IRBuilder ) : Value {
53+ export function buildFromString ( value : string , ctx : Context , builder : llvm . IRBuilder ) : Value {
5354 return new Primitive (
54- builder . createGlobalStringPtr (
55- node . text ,
56- ) ,
55+ builder . createGlobalStringPtr ( value ) ,
5756 ValueTypeEnum . STRING
5857 ) ;
5958}
6059
60+ export function buildFromStringValue ( node : ts . StringLiteral , ctx : Context , builder : llvm . IRBuilder ) : Value {
61+ return buildFromString ( node . text , ctx , builder ) ;
62+ }
63+
6164export function buildFromTrueKeyword ( node : ts . BooleanLiteral , ctx : Context , builder : llvm . IRBuilder ) : Value {
6265 return new Primitive (
6366 llvm . ConstantInt . get (
@@ -307,9 +310,10 @@ export function buildFromExpression(block: ts.Expression, ctx: Context, builder:
307310 return new CallExpressionCodeGenerator ( ) . generate ( < any > block , ctx , builder ) ;
308311 case ts . SyntaxKind . ExpressionStatement :
309312 return < any > buildFromExpression ( ( < any > block ) . expression , ctx , builder ) ;
310- case ts . SyntaxKind . ParenthesizedExpression : {
313+ case ts . SyntaxKind . TypeOfExpression :
314+ return new TypeOfExpressionCodeGenerator ( ) . generate ( block as ts . TypeOfExpression , ctx , builder ) ;
315+ case ts . SyntaxKind . ParenthesizedExpression :
311316 return buildFromExpression ( ( < ts . ParenthesizedExpression > block ) . expression , ctx , builder ) ;
312- }
313317 default :
314318 throw new UnsupportedError (
315319 block ,
0 commit comments