| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| final F::Identifier getMacroNameNode() { unified_macro_call_expr_def(this, result) } | ||
|
|
||
| /** Gets the node corresponding to the field `type_argument`. */ | ||
| final F::Expr getTypeArgument(int i) { unified_macro_call_expr_type_argument(this, i, result) } |
There was a problem hiding this comment.
The mapping drops Swift module qualifiers and incorrectly classifies compiler-provided expressions as macro calls.
Review effort: Balanced
Findings: 2
Adds Swift freestanding macro expansion support to the Unified AST.
Changes:
| File | Description |
|---|---|
| unified/extractor/ast_types.yml | Defines the macro-call AST shape. |
| unified/extractor/src/languages/swift/swift.rs | Maps Swift macro expansions. |
| unified/extractor/tests/corpus/swift/expressions/freestanding-macro-expansions.swift | Adds macro syntax fixtures. |
| unified/extractor/tests/corpus/swift/expressions/freestanding-macro-expansions.output | Records expected macro ASTs. |
| unified/extractor/tests/corpus/swift/literals/line-magic-literal.output | Reclassifies #line. |
| unified/ql/lib/unified.dbscheme | Adds generated database relations. |
| unified/ql/lib/codeql/unified/internal/Ast.qll | Adds generated QL classes and accessors. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Sorry, something went wrong.
| (argument name_node: (identifier #{label}) value: {closure}) | ||
| ), | ||
| rule!( | ||
| (macroExpansionExpr |
There was a problem hiding this comment.
I think handling these as macro calls might be just fine. And if not we can always tweak later.
Sorry, something went wrong.
| macroName: @@name | ||
| genericArgumentClause: (genericArgumentClause arguments: (genericArgument argument: @type_args)*)? |
There was a problem hiding this comment.
We're not handling moduleSelector anywhere yet, so this is consistent.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This PR adds a new macro call expr to the AST and translates Swift's freestanding macro calls into it.
In Swift the arguments to a function are guaranteed to be valid Swift syntax, so we simply process all the arguments recursively and includes the result as arguments to the macro.