From e0e1436930b4e0cfbd33c238f981cd6a588bdb02 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Mon, 3 Jun 2024 19:00:40 +0200 Subject: [PATCH 1/3] Fix bug oops :3 --- hscript/macros/ClassExtendMacro.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hscript/macros/ClassExtendMacro.hx b/hscript/macros/ClassExtendMacro.hx index 0bf6ada..a5af58e 100644 --- a/hscript/macros/ClassExtendMacro.hx +++ b/hscript/macros/ClassExtendMacro.hx @@ -341,7 +341,7 @@ class ClassExtendMacro { this.__interp.variables.set(name, val); return val; } - return super.hset(this, name); + return super.hset(name, val); } } else { macro { From 123a7de64a58a4f38dd4497d34b6c820a5a99fb9 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Fri, 26 Jul 2024 04:24:37 +0200 Subject: [PATCH 2/3] Fix Trigraph bug --- .gitignore | 2 ++ hscript/Interp.hx | 2 +- hscript/Parser.hx | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index ace37e6..68ab983 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /hscript.swf /release.zip + +tests/bin/* \ No newline at end of file diff --git a/hscript/Interp.hx b/hscript/Interp.hx index f9d61cb..6833b4c 100644 --- a/hscript/Interp.hx +++ b/hscript/Interp.hx @@ -183,7 +183,7 @@ class Interp { assignOp("<<=", function(v1, v2) return v1 << v2); assignOp(">>=", function(v1, v2) return v1 >> v2); assignOp(">>>=", function(v1, v2) return v1 >>> v2); - assignOp("??=", function(v1, v2) return v1 == null ? v2 : v1); + assignOp("??" + "=", function(v1, v2) return v1 == null ? v2 : v1); } function checkIsType(e1,e2): Bool { diff --git a/hscript/Parser.hx b/hscript/Parser.hx index e700b17..9d96213 100644 --- a/hscript/Parser.hx +++ b/hscript/Parser.hx @@ -126,7 +126,7 @@ class Parser { ["..."], ["&&"], ["||"], - ["=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","&=","^=","=>","??="], + ["=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","&=","^=","=>","??" + "="], ["->", "??"], ["is"] ]; @@ -1815,7 +1815,7 @@ class Parser { case '?'.code: var orp = readPos; if (readChar() == '='.code) - return TOp("??="); + return TOp("??" + "="); this.readPos = orp; return TOp("??"); From f18c7a2210260b2c471a989e22d7f7b2850f368b Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Fri, 2 Aug 2024 23:50:16 +0200 Subject: [PATCH 3/3] Small optimization --- hscript/macros/ClassExtendMacro.hx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hscript/macros/ClassExtendMacro.hx b/hscript/macros/ClassExtendMacro.hx index a5af58e..0d480d4 100644 --- a/hscript/macros/ClassExtendMacro.hx +++ b/hscript/macros/ClassExtendMacro.hx @@ -144,12 +144,16 @@ class ClassExtendMacro { //trace(getModuleName(cl)); + var hasNew = false; + for(_field in [fields.copy(), superFields.copy()]) for(f in _field) { if (f == null) continue; - if (f.name == "new") + if (f.name == "new") { + hasNew = true; continue; + } if (f.name.startsWith(FUNC_PREFIX)) continue; if (f.access.contains(ADynamic) || f.access.contains(AStatic) || f.access.contains(AExtern) || f.access.contains(AInline)) @@ -253,6 +257,13 @@ class ClassExtendMacro { } } + var totalFields = definedFields.length; + + if(totalFields == 0 && !hasNew) { + //Sys.println(cl.pack.join(".") + "." + cl.name + ", " + totalFields); + return fields; + } + shadowClass.kind = TDClass({ pack: cl.pack.copy(), name: cl.name