Skip to content

Commit b956ab2

Browse files
committed
Ignore partial keyword for classes.
Small clean up.
1 parent 222c690 commit b956ab2

File tree

2 files changed

+4
-68
lines changed

2 files changed

+4
-68
lines changed

CSharpToJavaScript/CSTOJS.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,11 +430,11 @@ private void Generate(SyntaxTree? tree, Assembly? assembly, List<MetadataReferen
430430
//
431431
//
432432
//Overriding root works only once.
433+
//ReplaceTokens? how?
433434
//I'm not sure how to properly fix this...
434435
//Below is a very bad code...
435436
//
436-
//
437-
List<SyntaxToken> allBraces = trueRoot.NormalizeWhitespace().DescendantTokens().Where((e) => e.IsKind(SyntaxKind.OpenBraceToken)).ToList();
437+
List<SyntaxToken> allBraces = trueRoot.DescendantTokens().Where((e) => e.IsKind(SyntaxKind.OpenBraceToken)).ToList();
438438
int i = 0;
439439
while (i < allBraces.Count)
440440
{
@@ -498,7 +498,7 @@ private void Generate(SyntaxTree? tree, Assembly? assembly, List<MetadataReferen
498498
}
499499

500500
//TODO! does not work... sigh
501-
references = references.Distinct().ToList();
501+
//references = references.Distinct().ToList();
502502

503503
if (_Options.Debug)
504504
{

CSharpToJavaScript/Walker.cs

Lines changed: 1 addition & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ public override void VisitClassDeclaration(ClassDeclarationSyntax node)
258258

259259
switch (kind)
260260
{
261+
case SyntaxKind.PartialKeyword:
261262
case SyntaxKind.StaticKeyword:
262263
break;
263264
case SyntaxKind.InternalKeyword:
@@ -2646,49 +2647,6 @@ public bool IdentifierToken(SyntaxNode node)
26462647
{
26472648
return false;
26482649
}
2649-
/*
2650-
if (iSymbol.DeclaringSyntaxReferences.Length >= 0)
2651-
{
2652-
if (_UsedThis == false)
2653-
{
2654-
_UsedThis = true;
2655-
2656-
VisitLeadingTrivia(identifier);
2657-
2658-
JSSB.Append($"this.");
2659-
VisitToken(identifier.WithoutTrivia());
2660-
2661-
VisitTrailingTrivia(identifier);
2662-
2663-
return true;
2664-
}
2665-
}
2666-
2667-
IEnumerable<SyntaxNode?> _all = from e in node.Parent.ChildNodes()
2668-
where e.IsKind(SyntaxKind.IdentifierName)
2669-
select e;
2670-
2671-
if (!_all.Any())
2672-
{
2673-
_all = from e in node.Parent.ChildNodes()
2674-
where e.IsKind(SyntaxKind.GenericName)
2675-
select e;
2676-
}
2677-
2678-
SymbolInfo _symbolInfo = _Model.GetSymbolInfo(_all.First());
2679-
ISymbol? _iSymbol = null;
2680-
2681-
if (_symbolInfo.CandidateSymbols.Length >= 1)
2682-
_iSymbol = _symbolInfo.CandidateSymbols[0];
2683-
else
2684-
_iSymbol = _symbolInfo.Symbol;
2685-
2686-
if (_iSymbol != null && _iSymbol.Kind == SymbolKind.Local)
2687-
{
2688-
//TODO! TEST THIS!
2689-
//DO NOT REMOVE BREAKPOINT TEST THIS!
2690-
//return false;
2691-
}*/
26922650

26932651
ClassDeclarationSyntax _class = (ClassDeclarationSyntax)node.Ancestors().FirstOrDefault(n => n.IsKind(SyntaxKind.ClassDeclaration));
26942652

@@ -2751,28 +2709,6 @@ where e.IsKind(SyntaxKind.IdentifierToken)
27512709

27522710
return true;
27532711
}
2754-
2755-
//Todo? Delete this
2756-
/*
2757-
DataFlowAnalysis _dfa = _Model.AnalyzeDataFlow(node);
2758-
2759-
if (_dfa.Succeeded == false)
2760-
_dfa = _Model.AnalyzeDataFlow(node.Parent);
2761-
2762-
if (_dfa.Succeeded == true)
2763-
{
2764-
if (_dfa.WrittenOutside[0].Name == "this" || iSymbol.IsStatic)
2765-
{
2766-
VisitLeadingTrivia(identifier);
2767-
2768-
JSSB.Append($"this.");
2769-
VisitToken(identifier.WithoutTrivia());
2770-
2771-
VisitTrailingTrivia(identifier);
2772-
2773-
return true;
2774-
}
2775-
}*/
27762712
}
27772713
}
27782714
}

0 commit comments

Comments
 (0)