From 957d8f1d44c72981d76eff9d8f9a5b2291ea5f98 Mon Sep 17 00:00:00 2001 From: Joe Savona Date: Wed, 15 Mar 2023 15:36:17 -0700 Subject: [PATCH] Remove incomplete try/catch support --- compiler/forget/src/HIR/BuildHIR.ts | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/compiler/forget/src/HIR/BuildHIR.ts b/compiler/forget/src/HIR/BuildHIR.ts index d1b2ffbc21..b87f4b1846 100644 --- a/compiler/forget/src/HIR/BuildHIR.ts +++ b/compiler/forget/src/HIR/BuildHIR.ts @@ -573,26 +573,6 @@ function lowerStatement( ); return; } - case "TryStatement": { - const stmt = stmtPath as NodePath; - /** - * NOTE: Accurately modeling control flow within a try statement would require treating - * effectively every expression as a possible branch point (since almost any expression can throw). - * Instead, we model the try statement as an atomic unit from a control-flow perspective, - * and rely on other passes to handle codegen for try statements - */ - lowerStatement(builder, stmt.get("block")); - const handler = stmt.get("handler"); - if (handler.node != null) { - // TODO: consider whether we need to track the param - lowerStatement(builder, handler.get("body") as NodePath); - } - const finalizer = stmt.get("finalizer"); - if (finalizer.node != null) { - lowerStatement(builder, finalizer as NodePath); - } - return; - } case "VariableDeclaration": { const stmt = stmtPath as NodePath; const nodeKind: t.VariableDeclaration["kind"] = stmt.node.kind; @@ -720,6 +700,7 @@ function lowerStatement( case "ImportDeclaration": case "InterfaceDeclaration": case "OpaqueType": + case "TryStatement": case "TypeAlias": case "TSDeclareFunction": case "TSEnumDeclaration":