Skip to content

Commit c845a24

Browse files
committed
Correction on FOREACH variable declaration
1 parent b01aebd commit c845a24

File tree

2 files changed

+36
-32
lines changed

2 files changed

+36
-32
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,5 @@ __pycache__/
262262
/ILSpy
263263
/ILSpy4
264264
/ILSpy5
265-
/ILSpy6
265+
/ILSpy6
266+
/ILSpy7

ILSpy.XSharpLanguage/XSharpOutputVisitor.prg

+34-31
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ USING Mono.Cecil
2424
BEGIN NAMESPACE ILSpy.XSharpLanguage
2525

2626
/// <summary>
27-
/// The XSharpOutputVisitor class.
28-
/// Visit/Walk all elements generated by the CSharpDecompiler, but generate the corresponding X# code
29-
/// See the XSharpLocalVisitor for LOCALs declaration
27+
/// The XSharpOutputVisitor class.
28+
/// Visit/Walk all elements generated by the CSharpDecompiler, but generate the corresponding X# code
29+
/// See the XSharpLocalVisitor for LOCALs declaration
3030
/// </summary>
3131
CLASS XSharpOutputVisitor IMPLEMENTS IAstVisitor
3232
// Fields
@@ -314,10 +314,10 @@ BEGIN NAMESPACE ILSpy.XSharpLanguage
314314
LOCAL i AS LONG
315315
//
316316
nextSibling := node:NextSibling
317-
// WHILE (((nextSibling IS WhitespaceNode) .OR. (nextSibling IS NewLineNode)))
318-
// //
319-
// nextSibling := nextSibling:NextSibling
320-
// ENDDO
317+
// WHILE (((nextSibling IS WhitespaceNode) .OR. (nextSibling IS NewLineNode)))
318+
// //
319+
// nextSibling := nextSibling:NextSibling
320+
// ENDDO
321321
IF (((node IS UsingDeclaration) .OR. (node IS UsingAliasDeclaration)) .AND. (! (nextSibling IS UsingDeclaration) .AND. ! (nextSibling IS UsingAliasDeclaration)))
322322
//
323323
i := 0
@@ -1408,7 +1408,7 @@ BEGIN NAMESPACE ILSpy.XSharpLanguage
14081408
ENDIF
14091409
//SELF:WriteToken(Roles.LChevron)
14101410
SELF:WriteCommaSeparatedList(;
1411-
functionPointerType:Parameters:Concat<AstNode>(<AstNode>{ functionPointerType:ReturnType }))
1411+
functionPointerType:Parameters:Concat<AstNode>(<AstNode>{ functionPointerType:ReturnType }))
14121412
//SELF:WriteToken(Roles.RChevron)
14131413
SELF:EndNode(functionPointerType)
14141414

@@ -1655,17 +1655,17 @@ BEGIN NAMESPACE ILSpy.XSharpLanguage
16551655

16561656
VIRTUAL METHOD VisitLocalFunctionDeclarationStatement(localFunctionDeclarationStatement AS LocalFunctionDeclarationStatement ) AS VOID
16571657
SELF:StartNode(localFunctionDeclarationStatement)
1658-
// SELF:WriteModifiers(localFunctionDeclarationStatement:ModifierTokens)
1659-
// localFunctionDeclarationStatement:ReturnType:AcceptVisitor(SELF)
1660-
// SELF:Space()
1661-
// SELF:WriteIdentifier(localFunctionDeclarationStatement:NameToken)
1662-
// SELF:WriteTypeParameters(localFunctionDeclarationStatement:TypeParameters)
1663-
// SELF:Space(SELF:policy:SpaceBeforeMethodDeclarationParentheses)
1664-
// SELF:WriteCommaSeparatedListInParenthesis(localFunctionDeclarationStatement:Parameters, SELF:policy:SpaceWithinMethodDeclarationParentheses)
1665-
// FOREACH constraint AS Constraint IN localFunctionDeclarationStatement:Constraints
1666-
// constraint:AcceptVisitor(SELF)
1667-
// NEXT
1668-
// SELF:WriteMethodBody(localFunctionDeclarationStatement:Body, SELF:policy:MethodBraceStyle)
1658+
// SELF:WriteModifiers(localFunctionDeclarationStatement:ModifierTokens)
1659+
// localFunctionDeclarationStatement:ReturnType:AcceptVisitor(SELF)
1660+
// SELF:Space()
1661+
// SELF:WriteIdentifier(localFunctionDeclarationStatement:NameToken)
1662+
// SELF:WriteTypeParameters(localFunctionDeclarationStatement:TypeParameters)
1663+
// SELF:Space(SELF:policy:SpaceBeforeMethodDeclarationParentheses)
1664+
// SELF:WriteCommaSeparatedListInParenthesis(localFunctionDeclarationStatement:Parameters, SELF:policy:SpaceWithinMethodDeclarationParentheses)
1665+
// FOREACH constraint AS Constraint IN localFunctionDeclarationStatement:Constraints
1666+
// constraint:AcceptVisitor(SELF)
1667+
// NEXT
1668+
// SELF:WriteMethodBody(localFunctionDeclarationStatement:Body, SELF:policy:MethodBraceStyle)
16691669
localFunctionDeclarationStatement:Declaration:AcceptVisitor(SELF)
16701670
SELF:EndNode(localFunctionDeclarationStatement)
16711671

@@ -1729,7 +1729,7 @@ BEGIN NAMESPACE ILSpy.XSharpLanguage
17291729
SELF:WriteKeyword("METHOD", NULL )
17301730
SELF:Space(TRUE)
17311731
//
1732-
SELF:WritePrivateImplementationType(methodDeclaration:PrivateImplementationType)
1732+
SELF:WritePrivateImplementationType(methodDeclaration:PrivateImplementationType)
17331733
SELF:WriteIdentifier(methodDeclaration:NameToken)
17341734
SELF:WriteTypeParameters(methodDeclaration:TypeParameters)
17351735
SELF:Space(SELF:policy:SpaceBeforeMethodDeclarationParentheses)
@@ -1804,7 +1804,7 @@ BEGIN NAMESPACE ILSpy.XSharpLanguage
18041804
SELF:NewLine()
18051805
SELF:EndNode(namespaceDeclaration)
18061806

1807-
//VIRTUAL METHOD VisitNewLine(newLineNode AS NewLineNode) AS VOID
1807+
//VIRTUAL METHOD VisitNewLine(newLineNode AS NewLineNode) AS VOID
18081808

18091809

18101810
PRIVATE METHOD VisitNodeInPattern(childNode AS INode) AS VOID
@@ -2043,12 +2043,12 @@ BEGIN NAMESPACE ILSpy.XSharpLanguage
20432043
VIRTUAL METHOD VisitPrimitiveExpression(primitiveExpression AS PrimitiveExpression) AS VOID
20442044
//
20452045
SELF:StartNode(primitiveExpression)
2046-
// SELF:writer:WritePrimitiveValue(primitiveExpression:Value, primitiveExpression:UnsafeLiteralValue)
2047-
// // Store Parameters Name
2048-
// IF ( SELF:inMethodAttributes == ClipperState.Attribute) .AND. SELF:isClipper
2049-
// SELF:paramsList:Add( primitiveExpression:Value:ToString() )
2050-
// ENDIF
2051-
// //
2046+
// SELF:writer:WritePrimitiveValue(primitiveExpression:Value, primitiveExpression:UnsafeLiteralValue)
2047+
// // Store Parameters Name
2048+
// IF ( SELF:inMethodAttributes == ClipperState.Attribute) .AND. SELF:isClipper
2049+
// SELF:paramsList:Add( primitiveExpression:Value:ToString() )
2050+
// ENDIF
2051+
// //
20522052
SELF:writer:WritePrimitiveValue(primitiveExpression:Value, primitiveExpression:Format )
20532053
SELF:isAfterSpace := FALSE
20542054
SELF:EndNode(primitiveExpression)
@@ -2353,7 +2353,10 @@ BEGIN NAMESPACE ILSpy.XSharpLanguage
23532353
SELF:WriteTypeArguments(simpleType:TypeArguments)
23542354
SELF:EndNode(simpleType)
23552355

2356-
VIRTUAL METHOD VisitSingleVariableDesignation( singleVariableDesignation AS SingleVariableDesignation ) AS VOID
2356+
VIRTUAL METHOD VisitSingleVariableDesignation( singleVariableDesignation AS SingleVariableDesignation ) AS VOID
2357+
SELF:StartNode(singleVariableDesignation)
2358+
SELF:WriteIdentifier(singleVariableDesignation:IdentifierToken)
2359+
SELF:EndNode(singleVariableDesignation)
23572360

23582361
VIRTUAL METHOD VisitSizeOfExpression(sizeOfExpression AS SizeOfExpression) AS VOID
23592362
//
@@ -2467,7 +2470,7 @@ BEGIN NAMESPACE ILSpy.XSharpLanguage
24672470
SELF:MaybeNewLinesAfterUsings(node)
24682471
NEXT
24692472

2470-
//VIRTUAL METHOD VisitText(textNode AS TextNode) AS VOID
2473+
//VIRTUAL METHOD VisitText(textNode AS TextNode) AS VOID
24712474

24722475

24732476
VIRTUAL METHOD VisitThisReferenceExpression(thisReferenceExpression AS ThisReferenceExpression) AS VOID
@@ -2885,7 +2888,7 @@ BEGIN NAMESPACE ILSpy.XSharpLanguage
28852888
SELF:NewLine()
28862889
SELF:EndNode(whileStatement)
28872890

2888-
//VIRTUAL METHOD VisitWhitespace(whitespaceNode AS WhitespaceNode) AS VOID
2891+
//VIRTUAL METHOD VisitWhitespace(whitespaceNode AS WhitespaceNode) AS VOID
28892892

28902893

28912894
VIRTUAL METHOD VisitYieldBreakStatement(yieldBreakStatement AS YieldBreakStatement) AS VOID
@@ -3250,7 +3253,7 @@ BEGIN NAMESPACE ILSpy.XSharpLanguage
32503253
SELF:WriteKeyword( "SELF" )
32513254
SELF:WriteToken( ":" )
32523255
ENDIF
3253-
ELSE
3256+
ELSE
32543257
ENDIF
32553258
ENDIF
32563259

0 commit comments

Comments
 (0)