Skip to content

Commit

Permalink
Correction on FOREACH variable declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
fforay committed Apr 21, 2022
1 parent b01aebd commit c845a24
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 32 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,5 @@ __pycache__/
/ILSpy
/ILSpy4
/ILSpy5
/ILSpy6
/ILSpy6
/ILSpy7
65 changes: 34 additions & 31 deletions ILSpy.XSharpLanguage/XSharpOutputVisitor.prg
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ USING Mono.Cecil
BEGIN NAMESPACE ILSpy.XSharpLanguage

/// <summary>
/// The XSharpOutputVisitor class.
/// Visit/Walk all elements generated by the CSharpDecompiler, but generate the corresponding X# code
/// See the XSharpLocalVisitor for LOCALs declaration
/// The XSharpOutputVisitor class.
/// Visit/Walk all elements generated by the CSharpDecompiler, but generate the corresponding X# code
/// See the XSharpLocalVisitor for LOCALs declaration
/// </summary>
CLASS XSharpOutputVisitor IMPLEMENTS IAstVisitor
// Fields
Expand Down Expand Up @@ -314,10 +314,10 @@ BEGIN NAMESPACE ILSpy.XSharpLanguage
LOCAL i AS LONG
//
nextSibling := node:NextSibling
// WHILE (((nextSibling IS WhitespaceNode) .OR. (nextSibling IS NewLineNode)))
// //
// nextSibling := nextSibling:NextSibling
// ENDDO
// WHILE (((nextSibling IS WhitespaceNode) .OR. (nextSibling IS NewLineNode)))
// //
// nextSibling := nextSibling:NextSibling
// ENDDO
IF (((node IS UsingDeclaration) .OR. (node IS UsingAliasDeclaration)) .AND. (! (nextSibling IS UsingDeclaration) .AND. ! (nextSibling IS UsingAliasDeclaration)))
//
i := 0
Expand Down Expand Up @@ -1408,7 +1408,7 @@ BEGIN NAMESPACE ILSpy.XSharpLanguage
ENDIF
//SELF:WriteToken(Roles.LChevron)
SELF:WriteCommaSeparatedList(;
functionPointerType:Parameters:Concat<AstNode>(<AstNode>{ functionPointerType:ReturnType }))
functionPointerType:Parameters:Concat<AstNode>(<AstNode>{ functionPointerType:ReturnType }))
//SELF:WriteToken(Roles.RChevron)
SELF:EndNode(functionPointerType)

Expand Down Expand Up @@ -1655,17 +1655,17 @@ BEGIN NAMESPACE ILSpy.XSharpLanguage

VIRTUAL METHOD VisitLocalFunctionDeclarationStatement(localFunctionDeclarationStatement AS LocalFunctionDeclarationStatement ) AS VOID
SELF:StartNode(localFunctionDeclarationStatement)
// SELF:WriteModifiers(localFunctionDeclarationStatement:ModifierTokens)
// localFunctionDeclarationStatement:ReturnType:AcceptVisitor(SELF)
// SELF:Space()
// SELF:WriteIdentifier(localFunctionDeclarationStatement:NameToken)
// SELF:WriteTypeParameters(localFunctionDeclarationStatement:TypeParameters)
// SELF:Space(SELF:policy:SpaceBeforeMethodDeclarationParentheses)
// SELF:WriteCommaSeparatedListInParenthesis(localFunctionDeclarationStatement:Parameters, SELF:policy:SpaceWithinMethodDeclarationParentheses)
// FOREACH constraint AS Constraint IN localFunctionDeclarationStatement:Constraints
// constraint:AcceptVisitor(SELF)
// NEXT
// SELF:WriteMethodBody(localFunctionDeclarationStatement:Body, SELF:policy:MethodBraceStyle)
// SELF:WriteModifiers(localFunctionDeclarationStatement:ModifierTokens)
// localFunctionDeclarationStatement:ReturnType:AcceptVisitor(SELF)
// SELF:Space()
// SELF:WriteIdentifier(localFunctionDeclarationStatement:NameToken)
// SELF:WriteTypeParameters(localFunctionDeclarationStatement:TypeParameters)
// SELF:Space(SELF:policy:SpaceBeforeMethodDeclarationParentheses)
// SELF:WriteCommaSeparatedListInParenthesis(localFunctionDeclarationStatement:Parameters, SELF:policy:SpaceWithinMethodDeclarationParentheses)
// FOREACH constraint AS Constraint IN localFunctionDeclarationStatement:Constraints
// constraint:AcceptVisitor(SELF)
// NEXT
// SELF:WriteMethodBody(localFunctionDeclarationStatement:Body, SELF:policy:MethodBraceStyle)
localFunctionDeclarationStatement:Declaration:AcceptVisitor(SELF)
SELF:EndNode(localFunctionDeclarationStatement)

Expand Down Expand Up @@ -1729,7 +1729,7 @@ BEGIN NAMESPACE ILSpy.XSharpLanguage
SELF:WriteKeyword("METHOD", NULL )
SELF:Space(TRUE)
//
SELF:WritePrivateImplementationType(methodDeclaration:PrivateImplementationType)
SELF:WritePrivateImplementationType(methodDeclaration:PrivateImplementationType)
SELF:WriteIdentifier(methodDeclaration:NameToken)
SELF:WriteTypeParameters(methodDeclaration:TypeParameters)
SELF:Space(SELF:policy:SpaceBeforeMethodDeclarationParentheses)
Expand Down Expand Up @@ -1804,7 +1804,7 @@ BEGIN NAMESPACE ILSpy.XSharpLanguage
SELF:NewLine()
SELF:EndNode(namespaceDeclaration)

//VIRTUAL METHOD VisitNewLine(newLineNode AS NewLineNode) AS VOID
//VIRTUAL METHOD VisitNewLine(newLineNode AS NewLineNode) AS VOID


PRIVATE METHOD VisitNodeInPattern(childNode AS INode) AS VOID
Expand Down Expand Up @@ -2043,12 +2043,12 @@ BEGIN NAMESPACE ILSpy.XSharpLanguage
VIRTUAL METHOD VisitPrimitiveExpression(primitiveExpression AS PrimitiveExpression) AS VOID
//
SELF:StartNode(primitiveExpression)
// SELF:writer:WritePrimitiveValue(primitiveExpression:Value, primitiveExpression:UnsafeLiteralValue)
// // Store Parameters Name
// IF ( SELF:inMethodAttributes == ClipperState.Attribute) .AND. SELF:isClipper
// SELF:paramsList:Add( primitiveExpression:Value:ToString() )
// ENDIF
// //
// SELF:writer:WritePrimitiveValue(primitiveExpression:Value, primitiveExpression:UnsafeLiteralValue)
// // Store Parameters Name
// IF ( SELF:inMethodAttributes == ClipperState.Attribute) .AND. SELF:isClipper
// SELF:paramsList:Add( primitiveExpression:Value:ToString() )
// ENDIF
// //
SELF:writer:WritePrimitiveValue(primitiveExpression:Value, primitiveExpression:Format )
SELF:isAfterSpace := FALSE
SELF:EndNode(primitiveExpression)
Expand Down Expand Up @@ -2353,7 +2353,10 @@ BEGIN NAMESPACE ILSpy.XSharpLanguage
SELF:WriteTypeArguments(simpleType:TypeArguments)
SELF:EndNode(simpleType)

VIRTUAL METHOD VisitSingleVariableDesignation( singleVariableDesignation AS SingleVariableDesignation ) AS VOID
VIRTUAL METHOD VisitSingleVariableDesignation( singleVariableDesignation AS SingleVariableDesignation ) AS VOID
SELF:StartNode(singleVariableDesignation)
SELF:WriteIdentifier(singleVariableDesignation:IdentifierToken)
SELF:EndNode(singleVariableDesignation)

VIRTUAL METHOD VisitSizeOfExpression(sizeOfExpression AS SizeOfExpression) AS VOID
//
Expand Down Expand Up @@ -2467,7 +2470,7 @@ BEGIN NAMESPACE ILSpy.XSharpLanguage
SELF:MaybeNewLinesAfterUsings(node)
NEXT

//VIRTUAL METHOD VisitText(textNode AS TextNode) AS VOID
//VIRTUAL METHOD VisitText(textNode AS TextNode) AS VOID


VIRTUAL METHOD VisitThisReferenceExpression(thisReferenceExpression AS ThisReferenceExpression) AS VOID
Expand Down Expand Up @@ -2885,7 +2888,7 @@ BEGIN NAMESPACE ILSpy.XSharpLanguage
SELF:NewLine()
SELF:EndNode(whileStatement)

//VIRTUAL METHOD VisitWhitespace(whitespaceNode AS WhitespaceNode) AS VOID
//VIRTUAL METHOD VisitWhitespace(whitespaceNode AS WhitespaceNode) AS VOID


VIRTUAL METHOD VisitYieldBreakStatement(yieldBreakStatement AS YieldBreakStatement) AS VOID
Expand Down Expand Up @@ -3250,7 +3253,7 @@ BEGIN NAMESPACE ILSpy.XSharpLanguage
SELF:WriteKeyword( "SELF" )
SELF:WriteToken( ":" )
ENDIF
ELSE
ELSE
ENDIF
ENDIF

Expand Down

0 comments on commit c845a24

Please sign in to comment.