mirror of
https://github.com/github/codeql.git
synced 2026-04-26 09:15:12 +02:00
C#: Add readonly modifier to fields during stub generation.
This commit is contained in:
@@ -306,7 +306,14 @@ internal sealed class StubVisitor : SymbolVisitor
|
||||
StubModifiers(symbol);
|
||||
|
||||
if (symbol.IsConst)
|
||||
{
|
||||
stubWriter.Write("const ");
|
||||
}
|
||||
|
||||
if (!symbol.IsConst && symbol.IsReadOnly)
|
||||
{
|
||||
stubWriter.Write("readonly ");
|
||||
}
|
||||
|
||||
if (IsUnsafe(symbol.Type))
|
||||
{
|
||||
@@ -317,7 +324,9 @@ internal sealed class StubVisitor : SymbolVisitor
|
||||
stubWriter.Write(" ");
|
||||
stubWriter.Write(EscapeIdentifier(symbol.Name));
|
||||
if (symbol.IsConst)
|
||||
{
|
||||
stubWriter.Write(" = default");
|
||||
}
|
||||
stubWriter.WriteLine(";");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user