fix whitespace

This commit is contained in:
2024-02-14 15:03:22 -07:00
parent 3599a6cc2d
commit 4cdc874a94

View File

@@ -261,7 +261,7 @@ class Kiss {
line: lineNumber, line: lineNumber,
column: column column: column
}; };
return _try(() -> { return _try(() -> {
var exp = null; var exp = null;
var stream = Stream.fromString(kissCode, pos); var stream = Stream.fromString(kissCode, pos);
@@ -292,7 +292,7 @@ class Kiss {
k.addVarInScope(v, false, field.access.indexOf(AStatic) != -1); k.addVarInScope(v, false, field.access.indexOf(AStatic) != -1);
default: default:
} }
} }
} }
} }
@@ -379,7 +379,7 @@ class Kiss {
} else { } else {
Path.join([loadingDirectory, kissFile]); Path.join([loadingDirectory, kissFile]);
}; };
var module = Context.getLocalModule(); var module = Context.getLocalModule();
if (module.length > 0) if (module.length > 0)
Context.registerModuleDependency(module, fullPath); Context.registerModuleDependency(module, fullPath);
@@ -410,12 +410,12 @@ class Kiss {
// readerExpToHaxeExpr must be called to process readermacro, alias, and macro definitions // readerExpToHaxeExpr must be called to process readermacro, alias, and macro definitions
macroUsed = false; macroUsed = false;
var expr = readerExpToHaxeExpr(nextExp, k); var expr = readerExpToHaxeExpr(nextExp, k);
// exps in the loaded file that actually become haxe expressions can be inserted into the // exps in the loaded file that actually become haxe expressions can be inserted into the
// file that loaded them at the position (load) was called. // file that loaded them at the position (load) was called.
// conditional compiler macros like (#when) tend to return empty blocks, or blocks containing empty blocks // conditional compiler macros like (#when) tend to return empty blocks, or blocks containing empty blocks
// when they contain field forms, so this should also be ignored // when they contain field forms, so this should also be ignored
// When calling from build(), we can't add all expressions to the (begin) returned by (load), because that will // When calling from build(), we can't add all expressions to the (begin) returned by (load), because that will
// cause double-evaluation of field forms // cause double-evaluation of field forms
if (loadAllExps) { if (loadAllExps) {
@@ -457,14 +457,14 @@ class Kiss {
} }
static var macroUsed = false; static var macroUsed = false;
#if kissCache #if kissCache
@:persistent @:persistent
static var expCache:Map<String,Expr> = null; static var expCache:Map<String,Expr> = null;
static var cacheThreshold = 0.05; static var cacheThreshold = 0.05;
#end #end
public static function readerExpToHaxeExpr(exp, k): Expr { public static function readerExpToHaxeExpr(exp, k): Expr {
return switch (macroExpandAndConvert(exp, k, false)) { return switch (macroExpandAndConvert(exp, k, false)) {
case Right(expr): expr; case Right(expr): expr;
@@ -487,16 +487,16 @@ class Kiss {
if (expCache == null) { if (expCache == null) {
expCache = new Map(); expCache = new Map();
} }
if (expCache.exists(str)) { if (expCache.exists(str)) {
return Right(expCache[str]); return Right(expCache[str]);
} }
} }
#end #end
if (k.conversionStack.length == 0) k.stateChanged = false; if (k.conversionStack.length == 0) k.stateChanged = false;
k.conversionStack.push(exp); k.conversionStack.push(exp);
var macros = k.macros; var macros = k.macros;
var fieldForms = k.fieldForms; var fieldForms = k.fieldForms;
var specialForms = k.specialForms; var specialForms = k.specialForms;
@@ -518,7 +518,7 @@ class Kiss {
default: throw "macroExpandAndConvert is broken"; default: throw "macroExpandAndConvert is broken";
}; };
} }
function leftForEach(convertedExps:Array<Either<ReaderExp,Expr>>) { function leftForEach(convertedExps:Array<Either<ReaderExp,Expr>>) {
return convertedExps.map(left); return convertedExps.map(left);
} }
@@ -558,7 +558,7 @@ class Kiss {
else else
metaParams.push([for (param in params) right(macroExpandAndConvert(param, k, false))]); metaParams.push([for (param in params) right(macroExpandAndConvert(param, k, false))]);
metaPos.push(Helpers.macroPos(exp)); metaPos.push(Helpers.macroPos(exp));
Right(right(macroExpandAndConvert(exp, k, false, metaNames, metaParams, metaPos))); Right(right(macroExpandAndConvert(exp, k, false, metaNames, metaParams, metaPos)));
} }
case Symbol(alias) if (k.identAliases.exists(alias)): case Symbol(alias) if (k.identAliases.exists(alias)):
var substitution = k.identAliases[alias].withPosOf(exp); var substitution = k.identAliases[alias].withPosOf(exp);
@@ -613,7 +613,7 @@ class Kiss {
Right(none); Right(none);
}; };
case CallExp({pos: _, def: Symbol(specialForm)}, args) if (specialForms.exists(specialForm) && !macroExpandOnly): case CallExp({pos: _, def: Symbol(specialForm)}, args) if (specialForms.exists(specialForm) && !macroExpandOnly):
checkNumArgs(specialForm); checkNumArgs(specialForm);
Right(Kiss.measure(specialForm, ()->specialForms[specialForm](exp, args.copy(), k), true)); Right(Kiss.measure(specialForm, ()->specialForms[specialForm](exp, args.copy(), k), true));
case CallExp({pos: _, def: Symbol(alias)}, args) if (k.callAliases.exists(alias)): case CallExp({pos: _, def: Symbol(alias)}, args) if (k.callAliases.exists(alias)):
convert(CallExp(k.callAliases[alias].withPosOf(exp), args).withPosOf(exp)); convert(CallExp(k.callAliases[alias].withPosOf(exp), args).withPosOf(exp));
@@ -705,7 +705,7 @@ class Kiss {
} }
return expr; return expr;
} }
public static function addVarInScope(k: KissState, v:Var, local:Bool, isStatic:Bool=false) { public static function addVarInScope(k: KissState, v:Var, local:Bool, isStatic:Bool=false) {
if (v.type != null) if (v.type != null)
k.typeHints.push(v); k.typeHints.push(v);
@@ -783,7 +783,7 @@ class Kiss {
}; };
// TODO should this also be in forHScript()? // TODO should this also be in forHScript()?
// In macro evaluation, // In macro evaluation,
copy.macros.remove("eval"); copy.macros.remove("eval");
// BECAUSE it is provided as a function instead. // BECAUSE it is provided as a function instead.