Skip to content

Commit 1f03468

Browse files
committed
NullableType is ignored for properties.
Added a console warning if the object initializer is used. Better output c# lines into js when debug is enabled. Clean up.
1 parent ba69d40 commit 1f03468

File tree

5 files changed

+92
-85
lines changed

5 files changed

+92
-85
lines changed

CSharpToJavaScript/APIs/JS/Ecma/Number.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ public partial class Number : NumberPrototype
1313
[To(ToAttribute.FirstCharToLowerCase)]
1414
public static NumberPrototype Prototype { get; } = new();
1515

16-
public const double EPSILON = 2.2204460492503130808472633361816 * 10-16;
17-
public const double MAX_SAFE_INTEGER = 9007199254740992;
18-
public const double MAX_VALUE = 1.7976931348623157 * 10308;
16+
public const double EPSILON = 2.2204460492503130808472633361816E-16;
17+
public const double MAX_SAFE_INTEGER = 9007199254740991;
18+
public const double MAX_VALUE = 1.79E+308;
1919
public const double MIN_SAFE_INTEGER = -9007199254740991;
20-
public const double MIN_VALUE = 5 * 10 -324;
20+
public const double MIN_VALUE = 5e-324;
2121
public GlobalObject.NaN NaN = new();
2222
public const double NEGATIVE_INFINITY = double.NegativeInfinity;
2323
public const double POSITIVE_INFINITY = double.PositiveInfinity;

CSharpToJavaScript/CSTOJS.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,9 @@ private void Generate(SyntaxTree? tree, Assembly? assembly, List<MetadataReferen
434434
//I'm not sure how to properly fix this...
435435
//Below is a very bad code...
436436
//
437+
//Todo! Delete 'tab' before 'EndOfLineTrivia', if there is any.
438+
//Also cant figure out how to use ReplaceTokens...
439+
//https://learn.microsoft.com/en-us/dotnet/api/microsoft.codeanalysis.syntaxnodeextensions.replacetokens?view=roslyn-dotnet-4.9.0
437440
List<SyntaxToken> allBraces = trueRoot.DescendantTokens().Where((e) => e.IsKind(SyntaxKind.OpenBraceToken)).ToList();
438441
int i = 0;
439442
while (i < allBraces.Count)

CSharpToJavaScript/CSTOJSOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public record class CSTOJSOptions
6464
public bool KeepBraceOnTheSameLine { get; set; } = false;
6565

6666
/// <summary>
67-
/// Self-explanatory, Normalize Whitespace. />
67+
/// Self-explanatory, Normalize Whitespace.
6868
/// </summary>
6969
/// <remarks>
7070
/// <blockquote class="NOTE"><h5>NOTE</h5><para>Note: If using with <see cref="CSTOJSOptions.KeepBraceOnTheSameLine" />. Normalization running before <see cref="CSTOJSOptions.KeepBraceOnTheSameLine" />.</para></blockquote>

CSharpToJavaScript/Utils/Unsupported.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
{
33
public class Unsupported
44
{
5+
public dynamic Value { get; set; }
56

7+
public static implicit operator Unsupported(string value) { return new Unsupported { Value = value }; }
8+
public static implicit operator Unsupported(double value) { return new Unsupported { Value = value }; }
9+
public static implicit operator Unsupported(float value) { return new Unsupported { Value = value }; }
10+
public static implicit operator Unsupported(int value) { return new Unsupported { Value = value }; }
611
}
712
}

0 commit comments

Comments
 (0)