Skip to content

Instantly share code, notes, and snippets.

@andyli
Created February 21, 2013 07:54
Show Gist options
  • Select an option

  • Save andyli/5003029 to your computer and use it in GitHub Desktop.

Select an option

Save andyli/5003029 to your computer and use it in GitHub Desktop.
Index: std/haxe/macro/ComplexTypeTools.hx
===================================================================
--- std/haxe/macro/ComplexTypeTools.hx (revision 6236)
+++ std/haxe/macro/ComplexTypeTools.hx (working copy)
@@ -48,7 +48,7 @@
If [c] is null, the result is null.
**/
static public function toType( c : ComplexType ) : Null<Type>
- return c == null ? null : haxe.macro.Context.typeof( { expr: ECheckType(macro null, c), pos: Context.currentPos() } )
+ return c == null ? null : haxe.macro.Context.typeof( { expr: ECheckType(macro null, c), pos: Context.currentPos() } );
#end
}
\ No newline at end of file
Index: std/haxe/macro/Printer.hx
===================================================================
--- std/haxe/macro/Printer.hx (revision 6236)
+++ std/haxe/macro/Printer.hx (working copy)
@@ -219,12 +219,12 @@
case TDEnum:
"enum " + t.name + (t.params.length > 0 ? "<" + t.params.map(printTypeParamDecl).join(",") + ">" : "") + " {\n"
+ [for (field in t.fields)
- tabs + (field.doc != null && field.doc != "" ? "/**\n" + tabs + tabs + StringTools.replace(field.doc, "\n", "\n" + tabs + tabs) + "\n" + tabs + "**/\n" + tabs : "")
+ tabs + (field.doc != null && field.doc != "" ? "/**\n" + tabs + tabString + StringTools.replace(field.doc, "\n", "\n" + tabs + tabString) + "\n" + tabs + "**/\n" + tabs : "")
+ (field.meta != null && field.meta.length > 0 ? field.meta.map(printMetadata).join(" ") + " " : "")
+ (switch(field.kind) {
- case FVar(_, _): field.name;
- case FProp(_, _, _, _): throw "FProp is invalid for TDEnum.";
- case FFun(func): field.name + printFunction(func);
+ case FVar(_, _): field.name;
+ case FProp(_, _, _, _): throw "FProp is invalid for TDEnum.";
+ case FFun(func): field.name + printFunction(func);
}) + ";"
].join("\n")
+ "\n}";
@@ -242,12 +242,7 @@
+ " {\n"
+ [for (f in t.fields) {
var fstr = printField(f);
- switch (f.kind) {
- case FVar(_, _), FProp(_, _, _, _):
- tabs + fstr + (StringTools.endsWith(fstr, "}") ? "" : ";");
- case FFun(f):
- tabs + fstr + (f.expr == null ? ";" : "");
- }
+ tabs + fstr + (StringTools.endsWith(fstr, "}") ? "" : ";");
}].join("\n")
+ "\n}";
case TDAlias(ct):
Index: std/haxe/macro/TypeTools.hx
===================================================================
--- std/haxe/macro/TypeTools.hx (revision 6236)
+++ std/haxe/macro/TypeTools.hx (working copy)
@@ -55,7 +55,7 @@
trace(t.follow()); //TInst(String,[])
**/
static public inline function follow( t : Type, ?once : Bool ) : Type
- return Context.follow(t, once)
+ return Context.follow(t, once);
/**
Returns a syntax-level type corresponding to Type [t].
@@ -67,7 +67,7 @@
If [t] is null, an internal exception is thrown.
**/
static public inline function toComplexType( t : Type ) : ComplexType
- return Context.toComplexType(t)
+ return Context.toComplexType(t);
/**
Tries to extract the class instance stored inside [t].
@@ -100,7 +100,7 @@
/**
Converts type [t] to a human-readable String representation.
**/
- static public function toString( t : Type ) : String return new String(Context.load("s_type", 1)(t))
+ static public function toString( t : Type ) : String return new String(Context.load("s_type", 1)(t));
#end
}
\ No newline at end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment