Skip to content

Commit e43fd3f

Browse files
committed
Ignore if the symbol is a namespace with built-ins.
Namespaces are later ignored completely, also, fewer useless warnings are printed.
1 parent ec7eca4 commit e43fd3f

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

CSharpToJavaScript/WithSemanticWalker.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -724,21 +724,22 @@ private bool BuiltInTypesGenerics(TypeSyntax node, ISymbol? symbol, out string s
724724

725725
//We need a symbol, if it is null, return.
726726
if (symbol == null)
727-
{
728-
//Log.WarningLine($"node: \"{node}\", symbol is null. USE \"CustomCSNamesToJS\"!");
729727
return false;
730-
}
731728

732729
//If symbol locations are zero, return. Treat as symbol null.
733730
//Also, if symbol in a source return, it is not a built-in type.
734731
if (symbol.Locations.Length == 0 || symbol.Locations[0].IsInSource)
735732
return false;
733+
734+
//If symbol is a namespace, return.
735+
//We do not translate namespaces as they are completely ignored later in WithoutSemanticRewriter.
736+
if(symbol.Kind == SymbolKind.Namespace)
737+
return false;
736738

737-
//Hitting with foreach, sooo return.
738-
//see Test_Foreach
739+
//If the node is a var, keep it(return) for extra safety, most likely, it will be replaced later in WithoutSemanticRewriter.
739740
if (node.IsVar)
740741
return false;
741-
742+
742743
ISymbol typeSymbol = symbol;
743744

744745
if (typeSymbol.Kind != SymbolKind.NamedType)

0 commit comments

Comments
 (0)