Skip to content

Commit

Permalink
fix compilation with Haxe 4
Browse files Browse the repository at this point in the history
  • Loading branch information
Simn committed May 5, 2018
1 parent c169727 commit e93da5a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 0 additions & 2 deletions build.hxml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
-dce full
-D analyzer-optimize
-D analyzer-user-var-fusion
--each

--next
--interp

#--next
Expand Down
18 changes: 15 additions & 3 deletions src/haxeparser/HaxeParser.hx
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ class HaxeParser extends hxparse.Parser<HaxeTokenSource, Token> implements hxpar
data: t
}), pos: punion(p1,p2)};
case [{tok:Kwd(KwdAbstract), pos:p1}, name = typeName(), tl = parseConstraintParams(), st = parseAbstractSubtype(), sl = parseRepeat(parseAbstractRelations), {tok:BrOpen}, fl = parseClassFields(false, p1)]:
var flags = c.map(function(flag) return switch(flag.e) { case EPrivate: APrivAbstract; case EExtern: AExtern; });
var flags = c.map(function(flag) return switch(flag.e) { case EPrivate: APrivAbstract; case EExtern: AbstractFlag.AExtern; });
if (st != null) {
flags.push(AIsType(st));
}
Expand Down Expand Up @@ -1630,10 +1630,22 @@ private class Reificator{
case ADynamic : "ADynamic";
case AInline : "AInline";
case AMacro : "AMacro";
case AExtern : "AExtern";
}
return mkEnum("Access", n, [], p);
}

function toDisplaykind(dk:DisplayKind, p:Position):Expr {
var n = switch(dk) {
case DKCall : "DKCall";
case DKDot : "DKDot";
case DKMarked : "DKMarked";
case DKStructure : "DKStructure";
case DKToplevel : "DKToplevel";
}
return mkEnum("DisplayKind", n, [], p);
}

function toCField(f:Field, p:Position):Expr {
var p2:Position = f.pos;

Expand Down Expand Up @@ -1798,8 +1810,8 @@ private class Reificator{
expr("EThrow", [loop(e)]);
case ECast(e, ct):
expr("ECast", [loop(e), toOpt(toCType, ct, p)]);
case EDisplay(e, flag):
expr("EDisplay", [loop(e), toBool(flag, p)]);
case EDisplay(e, dk):
expr("EDisplay", [loop(e), toDisplaykind(dk, p)]);
case EDisplayNew(t):
expr("EDisplayNew", [toTPath(t, p)]);
case ETernary(e1, e2, e3):
Expand Down

0 comments on commit e93da5a

Please sign in to comment.