Skip to content

Commit

Permalink
Correction on OPERATOR's method
Browse files Browse the repository at this point in the history
  • Loading branch information
fforay committed Dec 24, 2020
1 parent 48115a3 commit 7729ae6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ILSpy.XSharpLanguage/XSharpOutputVisitor.prg
Original file line number Diff line number Diff line change
Expand Up @@ -1867,12 +1867,12 @@ BEGIN NAMESPACE ILSpy.XSharpLanguage
SELF:WriteModifiers(operatorDeclaration:ModifierTokens)
IF (operatorDeclaration:OperatorType == OperatorType.Explicit)
//
SELF:WriteKeyword(OperatorDeclaration.ExplicitRole)
//SELF:WriteKeyword(OperatorDeclaration.ExplicitRole)
ELSE
//
IF (operatorDeclaration:OperatorType == OperatorType.Implicit)
//
SELF:WriteKeyword(OperatorDeclaration.ImplicitRole)
//SELF:WriteKeyword(OperatorDeclaration.ImplicitRole)
ELSE
//
needReturnType := TRUE
Expand Down Expand Up @@ -1900,6 +1900,11 @@ BEGIN NAMESPACE ILSpy.XSharpLanguage
ENDIF
//
SELF:WriteMethodBody(operatorDeclaration:Body, SELF:policy:MethodBraceStyle)
//
SELF:WriteKeyword( "END" )
SELF:Space(TRUE)
SELF:WriteKeyword( "OPERATOR" )
SELF:NewLine()
SELF:EndNode(operatorDeclaration)

PRIVATE METHOD VisitOptionalNode(optionalNode AS OptionalNode) AS VOID
Expand Down

1 comment on commit 7729ae6

@RobertvanderHulst
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fabrice,
I see the following problems remaining:

  • bool should be translated as LOGIC
  • IDisposable. METHOD Dispose() AS void: IDisposable. should go before the method name and not before the method keyword
  • BEGIN SWITCH rhs:_usualType: the BEGIN Keyword is not correct. It may work, I am not sure
  • expressions in an IF statement are surrounded with parentheses. That is not really needed.
  • Our "internal" type names such as __Date, __Usual etc should probably translated to DATE, USUAL etc.
  • PUBLIC STATIC implicit operator __Usual(val AS __Currency ). This should be PUBLIC STATIC OPERATOR IMPLICIT(val AS CURRENCY) AS USUAL

Please sign in to comment.