-
Notifications
You must be signed in to change notification settings - Fork 297
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
[CSharp] : Increase robustness - Block AST #5284
base: master
Are you sure you want to change the base?
Conversation
* fix methodFullName inside using block * code refactoring * Try handling change * added curly braces
@ankit-privado can you add more details/description to this PR |
@@ -173,4 +173,37 @@ class ControlStructureTests extends CSharpCode2CpgFixture { | |||
|
|||
} | |||
|
|||
"having using statement" should { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"having using statement" should { | |
"a variable defined within a using statement" should { |
|} | ||
|""".stripMargin) | ||
|
||
"resolve methodFullName" in { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"resolve methodFullName" in { | |
"partially resolve calls on the defined variable" in { |
@@ -362,11 +362,13 @@ trait AstForStatementsCreator(implicit withSchemaValidation: ValidationMode) { t | |||
* Thus, this is lowered as a try-finally, with finally making a call to `Dispose` on the declared variable. | |||
*/ | |||
private def astForUsingStatement(usingStmt: DotNetNodeInfo): Seq[Ast] = { | |||
val tryNode = controlStructureNode(usingStmt, ControlStructureTypes.TRY, code(usingStmt)) | |||
val tryNode = controlStructureNode(usingStmt, ControlStructureTypes.TRY, code(usingStmt)) | |||
val declAst = Try(createDotNetNodeInfo(usingStmt.json(ParserKeys.Declaration))) match { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given we throw away the exception, rather lets do something like
val declAst = Try(createDotNetNodeInfo(usingStmt.json(ParserKeys.Declaration))) match { | |
val declAst = Try(createDotNetNodeInfo(usingStmt.json(ParserKeys.Declaration))).map(astForNode).getOrElse(Seq.empty[Ast]) |
@khemrajrathore this PR was to handle code inside the |
No description provided.