Skip to content

Commit

Permalink
Properly generate optional string-Date fields
Browse files Browse the repository at this point in the history
Should fix issue #37
  • Loading branch information
helje5 committed Oct 26, 2024
1 parent e354ce0 commit 83050ef
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Created by Helge Heß.
// Copyright © 2022 ZeeZide GmbH.
// Copyright © 2022-2024 ZeeZide GmbH.
//

import LighterCodeGenAST
Expand Down Expand Up @@ -590,10 +590,10 @@ extension EnlighterASTGenerator {
!optional // but still yields an optional if dateformatter is nil
? .call(name: "\(database.name).dateFormatter?.string",
parameters: [ ( "from", ivar(propertyName) ) ])
: .flatMap(expression: ivar(propertyName), map: .call(
name: "\(database.name).dateFormatter?.string",
parameters: [ ( "from", .raw("$0") ) ]
))
: .flatMap(expression: ivar(propertyName), map: .closure([
.call(name: "\(database.name).dateFormatter?.string",
parameters: [ ( "from", .closureArg0 ) ])
]))
) ],
trailing: ( [ "s" ], [
.ifSwitch( (
Expand Down

0 comments on commit 83050ef

Please sign in to comment.