Skip to content

Commit c73117e

Browse files
committed
修复反复编译时缓存未清空的问题
1 parent aafd944 commit c73117e

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

Example/src/main/mcfpp/hello.mcfpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
func test(){
2+
23
print("qwq");
4+
int i = 0;
35
}

src/main/kotlin/top/mcfpp/Project.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,15 @@ object Project {
104104
compileStage++
105105
//全局缓存初始化
106106
GlobalField.init()
107+
ctx = null
108+
trees.clear()
109+
currNamespace = config.rootNamespace
110+
errorCount = 0
111+
warningCount = 0
112+
constants.clear()
113+
macroFunction.clear()
114+
classLoader = Thread.currentThread().contextClassLoader
115+
files.clear()
107116
stageProcessor[compileStage].forEach { it() }
108117
}
109118

src/main/kotlin/top/mcfpp/model/field/GlobalField.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ object GlobalField : FieldContainer, IField {
6464

6565
fun init(): GlobalField {
6666

67+
localNamespaces.clear()
68+
importedLibNamespaces.clear()
69+
libNamespaces.clear()
70+
stdNamespaces.clear()
71+
functionTags.clear()
72+
scoreboards.clear()
73+
6774
functionTags["minecraft:tick"] = FunctionTag.TICK
6875
functionTags["minecraft:load"] = FunctionTag.LOAD
6976

0 commit comments

Comments
 (0)