Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jssrc2cpg: Default Parameters Show Default in .code #2777

Merged
merged 1 commit into from
May 30, 2023

Conversation

DavidBakerEffendi
Copy link
Collaborator

Right now, while default parameter semantics are modelled in the CPG, there is no easy query for "Does this parameter have a default value?".

Now ideally, there would be some MethodParameterIn(defaultValue: Option[String]) or MethodParameterIn -DEFAULT-> Literal construct in the schema, but this PR is a quick-and-dirty way in the meantime to easily show a parameter is assigned a default.

Right now, while default parameter semantics are modelled in the CPG, there is no easy query for "Does this parameter have a default value?".

Now ideally, there would be some `MethodParameterIn(defaultValue: Option[String])` or `MethodParameterIn -DEFAULT-> Literal` construct in the schema, but this is a quick-and-dirty way to easily show a parameter is assigned a default.
@fabsx00
Copy link
Contributor

fabsx00 commented May 30, 2023

Which field are we changing here?

@DavidBakerEffendi
Copy link
Collaborator Author

@fabsx00 only the .code property. Currently, for parameters with defaults, name == code.

@fabsx00
Copy link
Contributor

fabsx00 commented May 30, 2023

Alright.

@DavidBakerEffendi DavidBakerEffendi merged commit 8ce8ffd into master May 30, 2023
@DavidBakerEffendi DavidBakerEffendi deleted the dave/jssrc-default-param-code branch May 30, 2023 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants