Skip to content

Commit 20b0283

Browse files
committed
Continue supporting RBS and Prism
1 parent 1adde68 commit 20b0283

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

main/pipeline/pipeline.cc

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,11 @@ parser::ParseResult runPrismParser(core::GlobalState &gs, core::FileRef file, co
271271
parser::Prism::ParseResult prismResult = parser.parseWithoutTranslation(collectComments);
272272

273273
auto node = prismResult.getRawNodePointer();
274-
if (gs.cacheSensitiveOptions.rbsEnabled) {
275-
node = runPrismRBSRewrite(gs, file, node, prismResult.getCommentLocations(), print, ctx, parser);
276-
}
274+
// TODO: Enable once RBS Prism pipeline is fully implemented. For now, we use the legacy RBS rewrite
275+
// path (see indexOne): https://github.com/sorbet/sorbet/issues/9065
276+
// if (gs.cacheSensitiveOptions.rbsEnabled) {
277+
// node = runPrismRBSRewrite(gs, file, node, prismResult.getCommentLocations(), print, ctx, parser);
278+
// }
277279

278280
bool directlyDesugar = !gs.cacheSensitiveOptions.rbsEnabled;
279281
auto translatedTree = parser::Prism::Translator(parser, ctx, prismResult.getParseErrors(), directlyDesugar,
@@ -464,12 +466,25 @@ ast::ParsedFile indexOne(const options::Options &opts, core::GlobalState &lgs, c
464466
}
465467
case options::Parser::PRISM: {
466468
auto parseResult = runPrismParser(lgs, file, print);
467-
parseTree = move(parseResult.tree);
468469

470+
// TODO: Move this check into runPrismParser when it performs rewriting
471+
// https://github.com/sorbet/sorbet/issues/9065
469472
if (opts.stopAfterPhase == options::Phase::PARSER) {
470473
return emptyParsedFile(file);
471474
}
472475

476+
// TODO: Remove once RBS Prism pipeline is fully implemented. For now, use the legacy
477+
// RBS rewrite path to ensure RBS support continues to work with Prism.
478+
if (lgs.cacheSensitiveOptions.rbsEnabled) {
479+
parseTree = runRBSRewrite(lgs, file, move(parseResult), print);
480+
} else {
481+
parseTree = move(parseResult.tree);
482+
}
483+
484+
if (opts.stopAfterPhase == options::Phase::RBS_REWRITER) {
485+
return emptyParsedFile(file);
486+
}
487+
473488
break;
474489
}
475490
}

0 commit comments

Comments
 (0)