changeset 2016:470a089c95aa

add LuanCompiler.fileVersion
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 02 Oct 2025 13:52:24 -0600
parents 61b0cc7db09c
children 65f36a905e1e
files src/luan/impl/LuanCompiler.java
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/luan/impl/LuanCompiler.java	Sat Sep 27 13:37:11 2025 -0700
+++ b/src/luan/impl/LuanCompiler.java	Thu Oct 02 13:52:24 2025 -0600
@@ -46,7 +46,9 @@
 			env.closure = closure;
 		}
 		return closure;
-	}
+	}
+
+	private static final String fileVersion = "1";
 
 	private static synchronized Class getClass(String sourceText,String sourceName)
 		throws LuanException
@@ -62,14 +64,14 @@
 		try {
 			byte[] a = MessageDigest.getInstance("MD5").digest(key.getBytes());
 			String s = Base64.getUrlEncoder().encodeToString(a);
-//System.err.println("qqqqqqqqqq "+s);
-			fileName = s + ".luanc";
+//System.err.println("qqqqqqqqqq "+sourceName);
+			fileName = s + "." + fileVersion + ".luanc";
 		} catch(NoSuchAlgorithmException e) {
 			throw new RuntimeException(e);
 		}
 		Compiled compiled = Compiled.load(fileName,key);
-		//Compiled compiled = null;
 		if( compiled==null ) {
+//System.err.println("qqqqqqqqqq compile");
 			compiled = getCompiled(sourceText,sourceName,null);
 			compiled.save(fileName,key);
 		}