Skip to content

Commit 735cd61

Browse files
committed
Clean up unused functions and imports
1 parent 02c42f0 commit 735cd61

File tree

10 files changed

+1
-151
lines changed

10 files changed

+1
-151
lines changed

src/cscompiler/CSCompiler.hx

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -152,26 +152,6 @@ class CSCompiler extends reflaxe.GenericCompiler<CSTopLevel, CSTopLevel, CSState
152152
}
153153
}
154154

155-
/**
156-
Returns the content generated for the `HaxeBoot.cs`.
157-
158-
TODO:
159-
Store `args` to use with `Sys.args()` later.
160-
**/
161-
function haxeBootContent(csCode: String) {
162-
return StringTools.trim(
163-
'
164-
namespace Haxe {
165-
class HaxeBoot {
166-
static void Main(string[] args) {
167-
${csCode};
168-
}
169-
}
170-
}
171-
'
172-
);
173-
}
174-
175155
/**
176156
Adds a .csproj file to the output directory.
177157

src/cscompiler/ast/CSClass.hx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package cscompiler.ast;
22

33
#if(macro || cs_runtime)
4-
import haxe.macro.Type;
5-
64
/**
75
Represents a class in C#.
86

src/cscompiler/ast/CSEnum.hx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package cscompiler.ast;
22

33
#if(macro || cs_runtime)
4-
import haxe.macro.Type;
5-
64
/**
75
Represents an enum in C#.
86

src/cscompiler/ast/CSExpr.hx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package cscompiler.ast;
22

33
#if(macro || cs_runtime)
4-
import cscompiler.ast.CSTypePath;
5-
6-
import haxe.macro.Expr;
74
import haxe.macro.Type;
85

96
/**

src/cscompiler/ast/CSModifier.hx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,12 @@ package cscompiler.ast;
33
#if(macro || cs_runtime)
44
enum CSModifier {
55
CSStatic;
6-
76
CSAbstract;
8-
97
CSVirtual;
10-
118
CSOverride;
12-
139
CSPublic;
14-
1510
CSPrivate;
16-
1711
CSProtected;
18-
1912
CSInternal;
2013
}
2114
#end

src/cscompiler/ast/CSStatement.hx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package cscompiler.ast;
22

33
#if(macro || cs_runtime)
4-
import cscompiler.ast.CSExpr;
5-
64
import haxe.macro.Type;
75

86
/**

src/cscompiler/components/CSCompiler_Class.hx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class CSCompiler_Class extends CSCompiler_Base {
4040
function init(classType: ClassType) {
4141
csFields = [];
4242

43-
final className = classType.name;
4443
csClassName = compiler.compileClassName(classType);
4544
csNameSpace = compiler.typeComp.getNameSpace(classType);
4645
}

src/cscompiler/components/CSCompiler_Enum.hx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ package cscompiler.components;
33
#if(macro || cs_runtime)
44
import haxe.macro.Type;
55

6-
import reflaxe.BaseCompiler;
76
import reflaxe.data.EnumOptionData;
8-
import reflaxe.helpers.OperatorHelper;
97

108
import cscompiler.ast.CSTopLevel;
119

src/cscompiler/components/CSCompiler_Expr.hx

Lines changed: 1 addition & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ package cscompiler.components;
44
import cscompiler.ast.*;
55
import cscompiler.ast.CSExprDef.CSInjectEntry;
66
import cscompiler.ast.CSStatement;
7-
import cscompiler.ast.CSVar.CSVarType;
87

98
import haxe.macro.Expr;
109
import haxe.macro.Type;
11-
import haxe.macro.TypeTools;
1210

1311
import reflaxe.compiler.TargetCodeInjection;
14-
import reflaxe.helpers.OperatorHelper;
1512

1613
using reflaxe.helpers.ModuleTypeHelper;
1714
using reflaxe.helpers.NameMetaHelper;
@@ -462,7 +459,7 @@ class CSCompiler_Expr extends CSCompiler_Base {
462459
final haxeType = {
463460
#if macro
464461
// This function does not exist outside of "macro" target.
465-
TypeTools.fromModuleType(maybeModuleType);
462+
haxe.macro.TypeTools.fromModuleType(maybeModuleType);
466463
#else
467464
throw "Impossible";
468465
#end
@@ -497,32 +494,6 @@ class CSCompiler_Expr extends CSCompiler_Base {
497494
}
498495
}
499496

500-
/**
501-
Generate a block scope from an expression.
502-
503-
If the typed expression is `TypedExprDef.TBlock`, then each
504-
sub-expression is compiled on a new line.
505-
506-
Otherwise, the expression is compiled normally.
507-
508-
Each line of the output is preemptively tabbed.
509-
**/
510-
function toIndentedScope(e: TypedExpr): String {
511-
return "";
512-
/*
513-
var el = switch(e.expr) {
514-
case TBlock(el): el;
515-
case _: [e];
516-
}
517-
518-
return if(el.length == 0) {
519-
"";
520-
} else {
521-
compiler.compileExpressionsIntoLines(el).tab();
522-
}
523-
*/
524-
}
525-
526497
/**
527498
Generate an expression given a `TConstant` (from `TypedExprDef.TConst`).
528499
**/
@@ -628,87 +599,6 @@ class CSCompiler_Expr extends CSCompiler_Base {
628599
];
629600
}
630601

631-
/**
632-
Generate an expression given a `Unop` and typed expression (from `TypedExprDef.TUnop`).
633-
**/
634-
function unopToCS(op: Unop, e: TypedExpr, isPostfix: Bool): String {
635-
final csExpr = compileToCSStatement(e);
636-
final operatorStr = OperatorHelper.unopToString(op);
637-
return isPostfix ? (csExpr + operatorStr) : (operatorStr + csExpr);
638-
}
639-
640-
/**
641-
Generate an expression given a `FieldAccess` and typed expression (from `TypedExprDef.TField`).
642-
**/
643-
function fieldAccessToCS(e: TypedExpr, fa: FieldAccess): String {
644-
final nameMeta: NameAndMeta = switch(fa) {
645-
case FInstance(_, _, classFieldRef): classFieldRef.get();
646-
case FStatic(_, classFieldRef): classFieldRef.get();
647-
case FAnon(classFieldRef): classFieldRef.get();
648-
case FClosure(_, classFieldRef): classFieldRef.get();
649-
case FEnum(_, enumField): enumField;
650-
case FDynamic(s): {
651-
name: s,
652-
meta: null
653-
};
654-
}
655-
656-
return if(nameMeta.hasMeta(":native")) {
657-
nameMeta.getNameOrNative();
658-
} else {
659-
final name = compiler.compileVarName(nameMeta.getNameOrNativeName());
660-
661-
// Check if a special field access and intercept.
662-
switch(fa) {
663-
case FStatic(clsRef, cfRef): {
664-
final cf = cfRef.get();
665-
final className = compiler.compileClassName(clsRef.get());
666-
// TODO: generate static access
667-
// return ...
668-
}
669-
case FEnum(_, enumField): {
670-
// TODO: generate enum access
671-
// return ...
672-
}
673-
case _:
674-
}
675-
676-
final csExpr = compileToCSStatement(e);
677-
678-
// Check if a special field access that requires the compiled expression.
679-
switch(fa) {
680-
case FAnon(classFieldRef): {
681-
// TODO: generate anon struct access
682-
// return ...
683-
}
684-
case _:
685-
}
686-
687-
csExpr + "." + name;
688-
}
689-
}
690-
691-
function compileIf(condExpr: TypedExpr, ifContentExpr: TypedExpr, elseExpr: Null<TypedExpr>) {
692-
var result = "if(" + compileToCSStatement(condExpr.unwrapParenthesis()) + ") {\n";
693-
result += toIndentedScope(ifContentExpr);
694-
if(elseExpr != null) {
695-
switch(elseExpr.expr) {
696-
case TIf(condExpr2, ifContentExpr2, elseExpr2): {
697-
result += "\n} else " + compileIf(condExpr2, ifContentExpr2, elseExpr2);
698-
}
699-
case _:
700-
{
701-
result += "\n} else {\n";
702-
result += toIndentedScope(elseExpr);
703-
result += "\n}";
704-
}
705-
}
706-
} else {
707-
result += "\n}";
708-
}
709-
return result;
710-
}
711-
712602
function compileFuncArgs(args: Array<{
713603
v: TVar,
714604
value: Null<TypedExpr>

src/cscompiler/components/CSCompiler_Type.hx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import haxe.macro.Type;
88

99
import cscompiler.ast.*;
1010
import cscompiler.config.Define;
11-
import cscompiler.config.NamespaceStyle;
1211
import cscompiler.config.NamespaceStyle.fromString as NamespaceStyle_fromString;
1312
import cscompiler.helpers.StringTools;
1413

0 commit comments

Comments
 (0)