From 8019c8893dd7d3c88674b7a5b088842ee423e840 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Tue, 24 Nov 2020 16:48:00 -0700 Subject: [PATCH] Rename haxe macro withPos() --- src/kiss/Helpers.hx | 2 +- src/kiss/Macros.hx | 6 +++--- src/kiss/SpecialForms.hx | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/kiss/Helpers.hx b/src/kiss/Helpers.hx index 847c5d8a..743432b5 100644 --- a/src/kiss/Helpers.hx +++ b/src/kiss/Helpers.hx @@ -6,7 +6,7 @@ import haxe.macro.Context; using StringTools; class Helpers { - public static function withPos(e:ExprDef):Expr { + public static function withContextPos(e:ExprDef):Expr { return { pos: Context.currentPos(), expr: e diff --git a/src/kiss/Macros.hx b/src/kiss/Macros.hx index b73f2ffd..bda9c703 100644 --- a/src/kiss/Macros.hx +++ b/src/kiss/Macros.hx @@ -64,9 +64,9 @@ class Macros { EFunction(FArrow, { args: [], ret: null, - expr: EReturn(k.convert(callArg)).withPos() - }).withPos() - ]).withPos(); + expr: EReturn(k.convert(callArg)).withContextPos() + }).withContextPos() + ]).withContextPos(); }; CallExp(Symbol("defun"), exps); diff --git a/src/kiss/SpecialForms.hx b/src/kiss/SpecialForms.hx index 9c18d108..28bbbc1f 100644 --- a/src/kiss/SpecialForms.hx +++ b/src/kiss/SpecialForms.hx @@ -37,7 +37,7 @@ class SpecialForms { case Symbol(name): name; default: throw 'first arg in (new [type] ...) should be a class to instantiate'; }; - ENew(Helpers.parseTypePath(classType), args.slice(1).map(convert)).withPos(); + ENew(Helpers.parseTypePath(classType), args.slice(1).map(convert)).withContextPos(); }; // TODO special form for assignment @@ -77,7 +77,7 @@ class SpecialForms { throw '(let....) expression with bindings $bindingPairs needs a body'; } - EBlock([EVars(varDefs).withPos(), EBlock(body.map(convert)).withPos()]).withPos(); + EBlock([EVars(varDefs).withContextPos(), EBlock(body.map(convert)).withContextPos()]).withContextPos(); }; // TODO special form for lambda @@ -100,7 +100,7 @@ class SpecialForms { ECheckType(convert(args[1]), switch (args[0]) { case Symbol(type): Helpers.parseComplexType(type); default: throw 'first argument to (the... ) should be a valid type'; - }).withPos(); + }).withContextPos(); }; map["try"] = (args:Array, convert:ExprConversion) -> { @@ -129,14 +129,14 @@ class SpecialForms { throw 'expressions following the first expression in a (try... ) should all be (catch... ) expressions, but you used $catchKissExp'; } } - ]).withPos(); + ]).withContextPos(); }; map["throw"] = (args:Array, convert:ExprConversion) -> { if (args.length != 1) { throw 'throw expression should only throw one value, not: $args'; } - EThrow(convert(args[0])).withPos(); + EThrow(convert(args[0])).withContextPos(); }; map["<"] = foldComparison("_min"); @@ -154,7 +154,7 @@ class SpecialForms { var thenExp = convert(args[1]); var elseExp = if (args.length > 2) convert(args[2]) else null; - EIf(condition, thenExp, elseExp).withPos(); + EIf(condition, thenExp, elseExp).withContextPos(); }; // TODO cond