Skip to content

AstNode.astParent is not set for ast root - mark that in return type - #2712

Open
mpollmeier wants to merge 1 commit into
masterfrom
michael/astParent-is-optional
Open

mpollmeier wants to merge 1 commit into
masterfrom
michael/astParent-is-optional

Conversation

@mpollmeier

Copy link
Copy Markdown
Contributor

the ast root doesn't have a parent:

cpg.method.head.astParent.astParent.astParent.astParent.astParent

java.util.NoSuchElementException
  at io.shiftleft.Implicits$JavaIteratorDeco$.onlyChecked$extension(Implicits.scala:43)
  at io.shiftleft.semanticcpg.language.nodemethods.AstNodeMethods$.astParent$extension(AstNodeMethods.scala:69)
  ... 39 elided

n.b. this isn't quite mergeable yet - I'll adapt downstream usage after
hearing your feedback...

the ast root doesn't have a parent:
```
cpg.method.head.astParent.astParent.astParent.astParent.astParent

java.util.NoSuchElementException
  at io.shiftleft.Implicits$JavaIteratorDeco$.onlyChecked$extension(Implicits.scala:43)
  at io.shiftleft.semanticcpg.language.nodemethods.AstNodeMethods$.astParent$extension(AstNodeMethods.scala:69)
  ... 39 elided
```

n.b. this isn't quite mergeable yet - I'll adapt downstream usage after
hearing your feedback...
@mpollmeier
mpollmeier requested review from fabsx00 and ml86 May 12, 2023 19:55
@mpollmeier

Copy link
Copy Markdown
Contributor Author

thanks @prabhu for bringing this up

@DavidBakerEffendi DavidBakerEffendi added bug Something isn't working compatibility Concerns fixing either upstream or downstream compatibility labels Jun 1, 2023

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working compatibility Concerns fixing either upstream or downstream compatibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants