Repository navigation
Conversation
asgerf
force-pushed
the
asgerf-swift-subscript-support
branch
3 times, most recently
from
November 16, 2026 10:38
82d058d to
8a57ce8
Compare
Extract subscript accesses as calls to a 'subscript' member, and subscript declarations as a 'subscript' getter method followed by a 'subscript' accessor of kind 'setter_method'. The setter clones the subscript parameters and takes the new value as an extra trailing positional parameter. Calls appearing as assignment targets, or written back after an in-place update, now invoke the corresponding setter method, generalizing the existing property setter call logic. MaD models can target setter calls by the 'name=' method name. Co-authored-by: Copilot App <[email protected]>
asgerf
force-pushed
the
asgerf-swift-subscript-support
branch
from
November 16, 2026 10:44
8a57ce8 to
b4ac4b1
Compare
| } | ||
|
|
||
| /** Gets the node corresponding to the field `type_parameter`. */ | ||
| final F::TypeParameter getTypeParameter(int i) { |
| * The new value is passed as an extra positional argument after the explicit ones. | ||
| */ | ||
| pragma[nomagic] | ||
| private predicate setterCallSelector(CallExpr call, string name, string argLabels) { |
Co-authored-by: Copilot App <[email protected]>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
xs[i]is now seen as a call to a member namedsubscript, i.e.xs.subscript(i).A subscript declaration can contain a getter and a setter, with a shared parameter list:
The getter is extracted as a
FunctionDeclarationnamedsubscript, and the setter becomes anAccessorDeclarationwith the accessor-kindsetter_method. We clone the parameter list so both callables get theirParameter(crude, but gets the job done). The setter is recognised on the QL side as aSetterMethodDeclaration.When a call appears as an assignment target, we use the existing
TSetterCallbranch ofDataFlowCallto represent the call to aSetterMethodDeclaration. For type inference, we just let the call resolve as normal (resolves to the getter).