diff --git a/compiler/forget/packages/playground/components/Editor/CompilerFlagsEditor.tsx b/compiler/forget/packages/playground/components/Editor/CompilerFlagsEditor.tsx deleted file mode 100644 index 69f245ae66..0000000000 --- a/compiler/forget/packages/playground/components/Editor/CompilerFlagsEditor.tsx +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - */ -import clsx from "clsx"; -import type { ForgetCompilerFlags } from "../../lib/compilerDriver"; -import { useStore, useStoreDispatch } from "../StoreContext"; - -// TODO: Allow collapsing the compiler options editor -export default function CompilerFlagsEditor() { - const store = useStore(); - const dispatch = useStoreDispatch(); - - return ( -
-
-

Compiler Options

-
-
- {Object.keys(store.compilerFlags).map((f) => { - const flag = f as keyof ForgetCompilerFlags; - const isChecked = store.compilerFlags[flag]; - - return ( - - ); - })} -
-
- ); -} diff --git a/compiler/forget/packages/playground/components/Editor/HIRTabContent.tsx b/compiler/forget/packages/playground/components/Editor/HIRTabContent.tsx deleted file mode 100644 index c0f60d7d4f..0000000000 --- a/compiler/forget/packages/playground/components/Editor/HIRTabContent.tsx +++ /dev/null @@ -1,207 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -import clsx from "clsx"; - -import { HIR } from "babel-plugin-react-forget"; -import { useState } from "react"; -import generate from "@babel/generator"; -import prettier from "prettier"; -import prettierParserBabel from "prettier/parser-babel"; - -const { - parseFunctions, - Environment, - enterSSA, - eliminateRedundantPhi, - inferReferenceEffects, - inferMutableRanges, - leaveSSA, - lower, - printHIR, - codegen, -} = HIR; - -export default function HIRTabContent({ source }: { source: string }) { - const astFunctions = parseFunctions(source); - - const [flags, setFlags] = useState({ - codegen: true, - eliminateRedundantPhi: true, - inferReferenceEffects: true, - inferMutableRanges: true, - leaveSSA: true, - }); - - return ( -
-
- {astFunctions.map((func, index): React.ReactNode => { - let body; - try { - const env = new Environment(); - const ir = lower(func, env); - enterSSA(ir, env); - if (flags.eliminateRedundantPhi) { - eliminateRedundantPhi(ir); - } - if (flags.inferReferenceEffects) { - inferReferenceEffects(ir); - } - if (flags.inferMutableRanges) { - inferMutableRanges(ir); - } - if (flags.leaveSSA) { - leaveSSA(ir); - } - - if (flags.codegen) { - const ast = codegen(ir); - const generated = generate( - ast, - { - sourceMaps: true, - sourceFileName: "input.js", - }, - source - ); - const formatted = prettier.format(generated.code, { - semi: true, - parser: "babel", - plugins: [prettierParserBabel], - }); - const sourceMapUrl = getSourceMapUrl( - generated.code, - JSON.stringify(generated.map) - ); - body = ( - <> -
{formatted}
- {sourceMapUrl && ( -