Skip to content

Commit

Permalink
TTypeExpr handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyfa committed Mar 16, 2024
1 parent 0243790 commit 97ad1ac
Showing 1 changed file with 34 additions and 22 deletions.
56 changes: 34 additions & 22 deletions src/cscompiler/components/CSCompiler_Expr.hx
Original file line number Diff line number Diff line change
Expand Up @@ -158,28 +158,40 @@ class CSCompiler_Expr extends CSCompiler_Base {
})
}
case TTypeExpr(m): {
// switch m {
// case TClassDecl(c):
// {
// haxeExpr: expr,
// def: CSExprStatement({
// haxeExpr: expr,
// def: CSTypeExpr()
// })
// }
// case TEnumDecl(e): {
// haxeExpr: expr,
// def: CSExprStatement({
// haxeExpr: expr,
// def: CSTypeExpr(compiler.typeComp.compileEnumType(e.get()))
// })
// }
// case TTypeDecl(t):
// null;
// case TAbstract(a):
// null;
// }
null;
// Note:
// we don't have access to type params here,
// so they are always empty.
switch m {
case TClassDecl(c):
{
haxeExpr: expr,
def: CSExprStatement({
haxeExpr: expr,
def: CSTypeExpr(compiler.compileType(TInst(c, []), expr.pos))
})
}
case TEnumDecl(e): {
haxeExpr: expr,
def: CSExprStatement({
haxeExpr: expr,
def: CSTypeExpr(compiler.compileType(TEnum(e, []), expr.pos))
})
}
case TTypeDecl(t): {
haxeExpr: expr,
def: CSExprStatement({
haxeExpr: expr,
def: CSTypeExpr(compiler.compileType(TType(t, []), expr.pos))
})
}
case TAbstract(a): {
haxeExpr: expr,
def: CSExprStatement({
haxeExpr: expr,
def: CSTypeExpr(compiler.compileType(TAbstract(a, []), expr.pos))
})
}
}
}
/*
case TParenthesis(e): {
Expand Down

0 comments on commit 97ad1ac

Please sign in to comment.