Skip to content

Commit 006ead3

Browse files
committed
[compiler][playground] Formatting changes to pass tabs
Summary: Compiler pass tabs are bolded when their contents have changed from previous passes; but currently the HIR and JS tabs are unbolded. Conceptually they should be, if HIR is "changed" from the source code and JS is "changed" from the last IR phase. In addition, the "show diff" option doesn't make a ton of sense for tabs that either aren't part of the pipeline (EnvironmentConfig) or (maybe more controversially, but imo) passes where the IR representation has changed since the last pass (BuildReactiveFunctions). This diff drops the button from those tabs. ghstack-source-id: 1d67e2f Pull Request resolved: #30151
1 parent f7c63d2 commit 006ead3

File tree

1 file changed

+5
-4
lines changed
  • compiler/apps/playground/components/Editor

1 file changed

+5
-4
lines changed

compiler/apps/playground/components/Editor/Output.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,14 @@ async function tabify(source: string, compilerOutput: CompilerOutput) {
9999
}
100100
}
101101
let lastPassOutput: string | null = null;
102+
let nonDiffPasses = ["HIR", "BuildReactiveFunction", "EnvironmentConfig"];
102103
for (const [passName, text] of concattedResults) {
103104
tabs.set(
104105
passName,
105106
<TextTabContent
106107
output={text}
107-
diff={passName !== "HIR" ? lastPassOutput : null}
108-
showInfoPanel={true}
108+
diff={lastPassOutput}
109+
showInfoPanel={!nonDiffPasses.includes(passName)}
109110
></TextTabContent>
110111
);
111112
lastPassOutput = text;
@@ -187,15 +188,15 @@ function Output({ store, compilerOutput }: Props) {
187188
});
188189
}, [store.source, compilerOutput]);
189190

190-
const changedPasses: Set<string> = new Set();
191+
const changedPasses: Set<string> = new Set(["JS", "HIR"]); // Initial and final passes should always be bold
191192
let lastResult: string = "";
192193
for (const [passName, results] of compilerOutput.results) {
193194
for (const result of results) {
194195
let currResult = "";
195196
if (result.kind === "hir" || result.kind === "reactive") {
196197
currResult += `function ${result.fnName}\n\n${result.value}`;
197198
}
198-
if (passName !== "HIR" && currResult !== lastResult) {
199+
if (currResult !== lastResult) {
199200
changedPasses.add(passName);
200201
}
201202
lastResult = currResult;

0 commit comments

Comments
 (0)