-
Notifications
You must be signed in to change notification settings - Fork 225
Closed
Labels
VB -> C#Specific to VB -> C# conversionSpecific to VB -> C# conversioncompilation errorA bug where the converted output won't compileA bug where the converted output won't compile
Description
In #159 I said
This will need to deal with inlining a const field as well as just constant literals.
I didn't actually implement this part so it will now leave you with a compile time error. Something like:
Input:
Public Class Test
Const x As Date = #1990-1-1#
Private Sub Y(ByVal opt As Date = x)
End Sub
End ClassErroneous output:
using System;
public class Test
{
DateTime x = DateTime.Parse("1990-01-01");
private void Y(DateTime opt = x)
{
}
}Expected output:
using System;
public class Test
{
private static DateTime x = DateTime.Parse("1990-01-01");
private void Y([Optional, DateTimeConstant(123456789L/*1990-01-01*/)] DateTime opt)
{
}
}Proposed work:
- Inline the tick count when a const field is used as an optional parameter
- Add a comment for what date it represents in the existing case and this case
- Make const date fields into static fields
Metadata
Metadata
Assignees
Labels
VB -> C#Specific to VB -> C# conversionSpecific to VB -> C# conversioncompilation errorA bug where the converted output won't compileA bug where the converted output won't compile