From 6bbe01fbefa0e9eca5d158cc80cc0d8b39ecf5fd Mon Sep 17 00:00:00 2001 From: Daniel Weber Date: Tue, 13 Nov 2018 20:11:11 +0000 Subject: [PATCH] made const fold pass kosher --- compiler/src/jlang/JLangScheduler.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/compiler/src/jlang/JLangScheduler.java b/compiler/src/jlang/JLangScheduler.java index fb7f6536..902d9454 100644 --- a/compiler/src/jlang/JLangScheduler.java +++ b/compiler/src/jlang/JLangScheduler.java @@ -104,8 +104,15 @@ public Goal JLangConstFold(Job job) { ExtensionInfo extInfo = job.extensionInfo(); JLangTypeSystem ts = (JLangTypeSystem) extInfo.typeSystem(); JLangNodeFactory nf = (JLangNodeFactory) extInfo.nodeFactory(); - return new VisitorGoal(job, new StringLitFold(ts, nf)); - + Goal constGoal = new VisitorGoal(job, new StringLitFold(ts, nf)); + try { + // ensure all desugaring is done for the file (might generate more constants) + constGoal.addPrerequisiteGoal(LLVMDesugared(job), this); + } catch (CyclicDependencyException e) { + throw new InternalCompilerError(e); + } + // intern goal to remove duplicate objects being created (explicit singleton) + return internGoal(constGoal); } @Override