mirror of
https://github.com/github/codeql.git
synced 2026-04-24 08:15:14 +02:00
Merge pull request #4094 from tamasvajk/feature/comp-gen-array-size
C# Compiler generated flag for length arguments of implicitly sized arrays
This commit is contained in:
@@ -17,7 +17,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
protected abstract ArrayTypeSyntax TypeSyntax { get; }
|
||||
|
||||
public abstract InitializerExpressionSyntax Initializer { get; }
|
||||
public abstract InitializerExpressionSyntax Initializer { get; }
|
||||
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
@@ -48,7 +48,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
ExprKind.INT_LITERAL,
|
||||
this,
|
||||
child,
|
||||
false,
|
||||
true,
|
||||
size.ToString());
|
||||
|
||||
new Expression(info);
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
| expressions.cs:168:27:168:44 | array creation of type Object[] | expressions.cs:168:27:168:44 | 1 | true |
|
||||
| expressions.cs:409:23:409:65 | array creation of type Int32[,] | expressions.cs:409:23:409:65 | 3 | true |
|
||||
| expressions.cs:409:23:409:65 | array creation of type Int32[,] | expressions.cs:409:23:409:65 | 3 | true |
|
||||
13
csharp/ql/test/library-tests/expressions/ArrayCreation11.ql
Normal file
13
csharp/ql/test/library-tests/expressions/ArrayCreation11.ql
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @name Test for array creations
|
||||
*/
|
||||
|
||||
import csharp
|
||||
|
||||
private boolean isImplicit(Expr expr) {
|
||||
if expr.isImplicit() then result = true else result = false
|
||||
}
|
||||
|
||||
from ArrayCreation ac, Expr expr
|
||||
where ac.isImplicitlySized() and not ac.isImplicitlyTyped() and expr = ac.getALengthArgument()
|
||||
select ac, expr, isImplicit(expr)
|
||||
Reference in New Issue
Block a user