Skip to content

Commit 4b27ab3

Browse files
committed
A few fixes with methods.
1 parent 31809a5 commit 4b27ab3

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

CSharpToJavaScript/CSTOJS.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,10 @@ public async Task GenerateOneFromStringAsync(string csstring, CSTOJSOptions? opt
240240
/// <exception cref="FileNotFoundException"></exception>
241241
public void GenerateOneContinuously(string path, CSTOJSOptions? options = null)
242242
{
243+
//TODO?
244+
//Currently overriding default options.
245+
//Either way, we need to exit from continuous mode.
246+
//See StopWatching where default options resets back.
243247
if (options != null)
244248
_DefaultOptions = options;
245249

@@ -264,7 +268,7 @@ public void GenerateOneContinuously(string path, CSTOJSOptions? options = null)
264268
_FSWatcher.IncludeSubdirectories = true;
265269
_FSWatcher.EnableRaisingEvents = true;
266270

267-
Log.WriteLine($"Watching to: {path}", options);
271+
Log.WriteLine($"Watching to: {path}", _DefaultOptions);
268272
}
269273
else
270274
{
@@ -343,7 +347,7 @@ private void Generate(SyntaxTree tree, Assembly? assembly, CSTOJSOptions options
343347
{
344348
references.Add(MetadataReference.CreateFromFile(Path.Combine(rtPath, "System.Private.CoreLib.dll")));
345349

346-
AssemblyName[] a = assembly.GetReferencedAssemblies();
350+
AssemblyName[] a = assembly?.GetReferencedAssemblies() ?? [];
347351
foreach (AssemblyName item in a)
348352
{
349353
if (File.Exists(Path.Combine(assemblyPath, item.Name + ".dll")))

CSharpToJavaScript/Walker.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,9 @@ public override void VisitClassDeclaration(ClassDeclarationSyntax node)
289289

290290
switch (kind)
291291
{
292+
case SyntaxKind.StructDeclaration:
293+
case SyntaxKind.OperatorDeclaration:
294+
case SyntaxKind.ConversionOperatorDeclaration:
292295
case SyntaxKind.AttributeList:
293296
{
294297
if (_Options.Debug)
@@ -551,6 +554,12 @@ public override void VisitBlock(BlockSyntax node)
551554

552555
switch (kind)
553556
{
557+
case SyntaxKind.UnsafeStatement:
558+
{
559+
if (_Options.Debug)
560+
Log.WarningLine($"\"{kind}\" not implemented or unlikely to be implemented. Ignoring! ({node.FullSpan}|l:{_Line}|{node.FullSpan.Start - _Characters}-{node.FullSpan.End - _Characters})\n|{asNode.ToFullString()}|", _Options);
561+
break;
562+
}
554563
case SyntaxKind.ExpressionStatement:
555564
VisitExpressionStatement(asNode as ExpressionStatementSyntax);
556565
break;
@@ -1009,7 +1018,7 @@ public override void VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node
10091018
if(_value is LiteralExpressionSyntax)
10101019
VisitLiteralExpression((LiteralExpressionSyntax)_value);
10111020
else
1012-
Log.ErrorLine($"asNode : {kind}\n|{asNode.ToFullString()}|", _Options);
1021+
Log.ErrorLine($"asNode : _value is {_value.Kind()}\n|{asNode.ToFullString()}|", _Options);
10131022
break;
10141023
}
10151024
default:
@@ -1105,6 +1114,7 @@ public override void VisitMethodDeclaration(MethodDeclarationSyntax node)
11051114
Log.WarningLine($"\"{kind}\" not implemented or unlikely to be implemented. Ignoring! ({node.FullSpan}|l:{_Line}|{node.FullSpan.Start - _Characters}-{node.FullSpan.End - _Characters})\n|{asNode.ToFullString()}|", _Options);
11061115
break;
11071116
}
1117+
case SyntaxKind.IdentifierName:
11081118
case SyntaxKind.GenericName:
11091119
case SyntaxKind.PredefinedType:
11101120
{
@@ -1115,9 +1125,9 @@ public override void VisitMethodDeclaration(MethodDeclarationSyntax node)
11151125
}
11161126
break;
11171127
}
1118-
case SyntaxKind.IdentifierName:
1119-
VisitIdentifierName((IdentifierNameSyntax)asNode);
1120-
break;
1128+
//case SyntaxKind.IdentifierName:
1129+
// VisitIdentifierName((IdentifierNameSyntax)asNode);
1130+
// break;
11211131
case SyntaxKind.ParameterList:
11221132
case SyntaxKind.Block:
11231133
Visit(asNode);

0 commit comments

Comments
 (0)