Skip to content

Commit 4be5cd6

Browse files
authored
Add parsing for function pointer types (#39879)
Add parsing for function pointer types
2 parents ac46298 + 3231dcc commit 4be5cd6

31 files changed

+4231
-17
lines changed

src/Compilers/CSharp/Portable/CSharpResources.Designer.cs

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Compilers/CSharp/Portable/CSharpResources.resx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5945,6 +5945,12 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
59455945
<data name="ERR_BadSwitchValue" xml:space="preserve">
59465946
<value>Command-line syntax error: '{0}' is not a valid value for the '{1}' option. The value must be of the form '{2}'.</value>
59475947
</data>
5948+
<data name="IDS_FeatureFunctionPointers" xml:space="preserve">
5949+
<value>function pointers</value>
5950+
</data>
5951+
<data name="ERR_InvalidFunctionPointerCallingConvention">
5952+
<value>'{0}' is not a valid calling convention for a function pointer. Valid conventions are 'cdecl', 'managed', 'unmanaged', 'thiscall', and 'stdcall'.</value>
5953+
</data>
59485954
<data name="ERR_InternalError" xml:space="preserve">
59495955
<value>Internal error in the C# compiler.</value>
59505956
</data>

src/Compilers/CSharp/Portable/Errors/ErrorCode.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,6 +1736,12 @@ internal enum ErrorCode
17361736

17371737
ERR_InternalError = 8751,
17381738

1739+
#region diagnostics introduced in preview
1740+
1741+
ERR_InvalidFunctionPointerCallingConvention = 8752,
1742+
1743+
#endregion
1744+
17391745
// Note: you will need to re-generate compiler code after adding warnings (eng\generate-compiler-code.cmd)
17401746
}
17411747
}

src/Compilers/CSharp/Portable/Errors/MessageID.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ internal enum MessageID
185185
IDS_FeatureSwitchExpression = MessageBase + 12763,
186186
IDS_FeatureAsyncUsing = MessageBase + 12764,
187187
IDS_FeatureLambdaDiscardParameters = MessageBase + 12765,
188+
IDS_FeatureFunctionPointers = MessageBase + 12766,
188189
}
189190

190191
// Message IDs may refer to strings that need to be localized.
@@ -293,6 +294,7 @@ internal static LanguageVersion RequiredVersion(this MessageID feature)
293294
{
294295
// Preview features.
295296
case MessageID.IDS_FeatureLambdaDiscardParameters: // semantic check
297+
case MessageID.IDS_FeatureFunctionPointers:
296298
return LanguageVersion.Preview;
297299

298300
// C# 8.0 features.

src/Compilers/CSharp/Portable/Generated/CSharp.Generated.g4

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)