Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

Commit 3c8be31

Browse files
committed
unified: Preserve empty unsupported node content
Bare leaf rule results now inherit the matched source text. Existing unsupported Swift nodes previously had empty content, so this changed the control-flow test output even though their AST structure was unchanged. To fix this, we now give `unsupported_node` results explicit empty content, leaving `super_expr` as the intentional inherited leaf and preserving existing extraction behaviour.
1 parent adcbd15 commit 3c8be31

1 file changed

Lines changed: 34 additions & 31 deletions

File tree

  • unified/extractor/src/languages/swift

‎unified/extractor/src/languages/swift/swift.rs‎

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,9 @@ fn translation_rules() -> Vec<Rule<SwiftContext>> {
622622
// A type-casting pattern (`case is T`). Not yet supported, so it is
623623
// mapped to `unsupported_node` — an explicit reminder that this needs
624624
// handling in the future. (Redundant with the catch-all fallback, but
625-
// kept as a signpost.)
626-
rule!((isTypePattern) => (unsupported_node)),
625+
// kept as a signpost.) Its explicit empty content preserves the
626+
// existing representation instead of inheriting the matched source.
627+
rule!((isTypePattern) => (unsupported_node "")),
627628
// A wildcard *binding* pattern (`let _ = x`, `for _ in xs`). swift-syntax
628629
// models this as a `wildcardPattern`, distinct from the `_` match form
629630
// handled by the context-aware `discardAssignmentExpr` rule.
@@ -1523,35 +1524,37 @@ fn translation_rules() -> Vec<Rule<SwiftContext>> {
15231524
// These kinds can reach translation independently, but we do not
15241525
// currently map them to the unified AST. Syntax nested inside one of
15251526
// these roots is discarded with its parent and needs no separate rule.
1526-
rule!((actorDecl) => (unsupported_node)),
1527-
rule!((borrowExpr) => (unsupported_node)),
1528-
rule!((classRestrictionType) => (unsupported_node)),
1529-
rule!((compositionType) => (unsupported_node)),
1530-
rule!((consumeExpr) => (unsupported_node)),
1531-
rule!((copyExpr) => (unsupported_node)),
1532-
rule!((discardStmt) => (unsupported_node)),
1533-
rule!((fallThroughStmt) => (unsupported_node)),
1534-
rule!((ifConfigDecl) => (unsupported_node)),
1535-
rule!((implicitlyUnwrappedOptionalType) => (unsupported_node)),
1536-
rule!((inlineArrayType) => (unsupported_node)),
1537-
rule!((keyPathExpr) => (unsupported_node)),
1538-
rule!((macroDecl) => (unsupported_node)),
1539-
rule!((metatypeType) => (unsupported_node)),
1540-
rule!((namedOpaqueReturnType) => (unsupported_node)),
1541-
rule!((operatorDecl) => (unsupported_node)),
1542-
rule!((packElementExpr) => (unsupported_node)),
1543-
rule!((packElementType) => (unsupported_node)),
1544-
rule!((packExpansionExpr) => (unsupported_node)),
1545-
rule!((packExpansionType) => (unsupported_node)),
1546-
rule!((postfixIfConfigExpr) => (unsupported_node)),
1547-
rule!((poundSourceLocation) => (unsupported_node)),
1548-
rule!((precedenceGroupDecl) => (unsupported_node)),
1549-
rule!((someOrAnyType) => (unsupported_node)),
1550-
rule!((subscriptDecl) => (unsupported_node)),
1551-
rule!((suppressedType) => (unsupported_node)),
1552-
rule!((typeExpr) => (unsupported_node)),
1553-
rule!((unsafeExpr) => (unsupported_node)),
1554-
rule!((yieldStmt) => (unsupported_node)),
1527+
// Explicit empty content preserves their existing representation
1528+
// instead of inheriting the matched source text.
1529+
rule!((actorDecl) => (unsupported_node "")),
1530+
rule!((borrowExpr) => (unsupported_node "")),
1531+
rule!((classRestrictionType) => (unsupported_node "")),
1532+
rule!((compositionType) => (unsupported_node "")),
1533+
rule!((consumeExpr) => (unsupported_node "")),
1534+
rule!((copyExpr) => (unsupported_node "")),
1535+
rule!((discardStmt) => (unsupported_node "")),
1536+
rule!((fallThroughStmt) => (unsupported_node "")),
1537+
rule!((ifConfigDecl) => (unsupported_node "")),
1538+
rule!((implicitlyUnwrappedOptionalType) => (unsupported_node "")),
1539+
rule!((inlineArrayType) => (unsupported_node "")),
1540+
rule!((keyPathExpr) => (unsupported_node "")),
1541+
rule!((macroDecl) => (unsupported_node "")),
1542+
rule!((metatypeType) => (unsupported_node "")),
1543+
rule!((namedOpaqueReturnType) => (unsupported_node "")),
1544+
rule!((operatorDecl) => (unsupported_node "")),
1545+
rule!((packElementExpr) => (unsupported_node "")),
1546+
rule!((packElementType) => (unsupported_node "")),
1547+
rule!((packExpansionExpr) => (unsupported_node "")),
1548+
rule!((packExpansionType) => (unsupported_node "")),
1549+
rule!((postfixIfConfigExpr) => (unsupported_node "")),
1550+
rule!((poundSourceLocation) => (unsupported_node "")),
1551+
rule!((precedenceGroupDecl) => (unsupported_node "")),
1552+
rule!((someOrAnyType) => (unsupported_node "")),
1553+
rule!((subscriptDecl) => (unsupported_node "")),
1554+
rule!((suppressedType) => (unsupported_node "")),
1555+
rule!((typeExpr) => (unsupported_node "")),
1556+
rule!((unsafeExpr) => (unsupported_node "")),
1557+
rule!((yieldStmt) => (unsupported_node "")),
15551558
// Anything reaching this final generic handler has neither a
15561559
// dedicated rule nor an explicit unsupported entry.
15571560
rule!(

0 commit comments

Comments
 (0)