Skip to content

Commit 73c2898

Browse files
committed
C#: Minor edits.
1 parent 5679a72 commit 73c2898

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

csharp/extractor/Semmle.Extraction.CSharp/Entities/Statements/LocalDeclaration.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using Microsoft.CodeAnalysis;
21
using Microsoft.CodeAnalysis.CSharp.Syntax;
32
using Semmle.Extraction.CSharp.Entities.Expressions;
43
using Semmle.Extraction.Kinds;
@@ -9,9 +8,11 @@ class LocalDeclaration : Statement<LocalDeclarationStatementSyntax>
98
{
109
static StmtKind GetKind(LocalDeclarationStatementSyntax declStmt)
1110
{
12-
if (declStmt.UsingKeyword.RawKind != 0) return StmtKind.USING_DECL;
11+
if (declStmt.UsingKeyword.RawKind != 0)
12+
return StmtKind.USING_DECL;
1313

14-
if (declStmt.IsConst) return StmtKind.CONST_DECL;
14+
if (declStmt.IsConst)
15+
return StmtKind.CONST_DECL;
1516

1617
return StmtKind.VAR_DECL;
1718
}

csharp/ql/src/semmle/code/csharp/Stmt.qll

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,15 +1115,15 @@ class LockStmt extends Stmt, @lock_stmt {
11151115
}
11161116

11171117
/**
1118-
* A using block or declaration. Either a using declaration (`UsingDecStmt`) or
1118+
* A using block or declaration. Either a using declaration (`UsingDeclStmt`) or
11191119
* a using block (`UsingBlockStmt`).
11201120
*/
11211121
class UsingStmt extends Stmt, @using_stmt {
11221122
/** Gets the `i`th local variable declaration of this `using` statement. */
11231123
LocalVariableDeclExpr getVariableDeclExpr(int i) { none() }
11241124

11251125
/** Gets a local variable declaration of this `using` statement. */
1126-
LocalVariableDeclExpr getAVariableDeclExpr() { none() }
1126+
LocalVariableDeclExpr getAVariableDeclExpr() { result = this.getVariableDeclExpr(_) }
11271127

11281128
/**
11291129
* DEPRECATED: Use UsingBlockStmt.getExpr() instead.
@@ -1165,9 +1165,6 @@ class UsingBlockStmt extends UsingStmt, @using_block_stmt {
11651165
/** Gets the `i`th local variable declaration of this `using` statement. */
11661166
override LocalVariableDeclExpr getVariableDeclExpr(int i) { result = this.getChild(-i - 1) }
11671167

1168-
/** Gets a local variable declaration of this `using` statement. */
1169-
override LocalVariableDeclExpr getAVariableDeclExpr() { result = this.getVariableDeclExpr(_) }
1170-
11711168
/**
11721169
* Gets the expression directly used by this `using` statement, if any. For
11731170
* example, `f` on line 2 in

0 commit comments

Comments
 (0)