Skip to content

Commit

Permalink
Simplify and skip some unnecessary work
Browse files Browse the repository at this point in the history
  • Loading branch information
Viir committed Sep 24, 2024
1 parent 49ba4c8 commit 4b7c31e
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions implement/pine/ElmTime/compile-elm-program/src/ElmCompiler.elm
Original file line number Diff line number Diff line change
Expand Up @@ -3445,25 +3445,25 @@ reportEmittedDeclarationsForErrorMsg emittedDeclarations =
emittedDeclarations


compileElmChoiceTypeTagConstructor : ( String, Int ) -> (List Expression -> Expression)
compileElmChoiceTypeTagConstructor ( tagName, argumentsCount ) =
let
tagNameAsValue =
Pine.valueFromString tagName

( _, genericContructorValue ) =
compileElmChoiceTypeTagConstructorValue ( tagName, argumentsCount )
in
\arguments ->
if List.length arguments == argumentsCount then
inlineElmSyntaxValueConstructor
tagNameAsValue
arguments
compileElmChoiceTypeTagConstructor : ( String, Int ) -> List Expression -> Expression
compileElmChoiceTypeTagConstructor ( tagName, argumentsCount ) arguments =
if List.length arguments == argumentsCount then
let
tagNameAsValue =
Pine.valueFromString tagName
in
inlineElmSyntaxValueConstructor
tagNameAsValue
arguments

else
applicableDeclarationFromConstructorExpression
(LiteralExpression genericContructorValue)
arguments
else
let
( _, genericContructorValue ) =
compileElmChoiceTypeTagConstructorValue ( tagName, argumentsCount )
in
applicableDeclarationFromConstructorExpression
(LiteralExpression genericContructorValue)
arguments


applicableDeclarationFromConstructorExpression : Expression -> (List Expression -> Expression)
Expand Down

0 comments on commit 4b7c31e

Please sign in to comment.