@samitouri / QOS-React-2 / commits / 957d8f1d44

Remove incomplete try/catch support

Joe Savona committed Mar 15, 2023 at 15:36 UTC 957d8f1d44c72981d76eff9d8f9a5b2291ea5f98
1 file changed +1 -20
compiler/forget/src/HIR/BuildHIR.ts
+1 -20
@@ -573,26 +573,6 @@ function lowerStatement(
573 );
574 return;
575 }
576 - case "TryStatement": {
577 - const stmt = stmtPath as NodePath<t.TryStatement>;
578 - /**
579 - * NOTE: Accurately modeling control flow within a try statement would require treating
580 - * effectively every expression as a possible branch point (since almost any expression can throw).
581 - * Instead, we model the try statement as an atomic unit from a control-flow perspective,
582 - * and rely on other passes to handle codegen for try statements
583 - */
584 - lowerStatement(builder, stmt.get("block"));
585 - const handler = stmt.get("handler");
586 - if (handler.node != null) {
587 - // TODO: consider whether we need to track the param
588 - lowerStatement(builder, handler.get("body") as NodePath<t.Statement>);
589 - }
590 - const finalizer = stmt.get("finalizer");
591 - if (finalizer.node != null) {
592 - lowerStatement(builder, finalizer as NodePath<t.Statement>);
593 - }
594 - return;
595 - }
576 case "VariableDeclaration": {
577 const stmt = stmtPath as NodePath<t.VariableDeclaration>;
578 const nodeKind: t.VariableDeclaration["kind"] = stmt.node.kind;
@@ -720,6 +700,7 @@ function lowerStatement(
700 case "ImportDeclaration":
701 case "InterfaceDeclaration":
702 case "OpaqueType":
703 + case "TryStatement":
704 case "TypeAlias":
705 case "TSDeclareFunction":
706 case "TSEnumDeclaration":