Skip to content
This repository was archived by the owner on Nov 24, 2020. It is now read-only.

Commit ee97aa1

Browse files
author
Fabricio Carvalhal
committed
feat: added money type as Int64 on swift target
1 parent d81689e commit ee97aa1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/target/swift.cr

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ abstract class SwiftTarget < Target
1212
when AST::BoolPrimitiveType ; "Bool"
1313
when AST::BytesPrimitiveType ; "Data"
1414
when AST::VoidPrimitiveType ; "NoReply"
15+
when AST::MoneyPrimitiveType ; "Int64"
1516
else
1617
raise "BUG! Should handle primitive #{t.class}"
1718
end
@@ -38,6 +39,7 @@ abstract class SwiftTarget < Target
3839
when AST::StringPrimitiveType ; path
3940
when AST::IntPrimitiveType ; path
4041
when AST::UIntPrimitiveType ; path
42+
when AST::MoneyPrimitiveType ; path
4143
when AST::FloatPrimitiveType ; path
4244
when AST::DatePrimitiveType ; path
4345
when AST::DateTimePrimitiveType; path
@@ -158,7 +160,7 @@ END
158160
case t
159161
when AST::StringPrimitiveType
160162
"\"\""
161-
when AST::IntPrimitiveType, AST::UIntPrimitiveType, AST::FloatPrimitiveType
163+
when AST::IntPrimitiveType, AST::UIntPrimitiveType, AST::FloatPrimitiveType, AST::MoneyPrimitiveType
162164
"0"
163165
when AST::BoolPrimitiveType
164166
"false"
@@ -185,7 +187,7 @@ END
185187

186188
def type_to_json(t : AST::Type, src : String)
187189
case t
188-
when AST::StringPrimitiveType, AST::IntPrimitiveType, AST::UIntPrimitiveType, AST::FloatPrimitiveType, AST::BoolPrimitiveType
190+
when AST::StringPrimitiveType, AST::IntPrimitiveType, AST::UIntPrimitiveType, AST::FloatPrimitiveType, AST::BoolPrimitiveType, AST::MoneyPrimitiveType
189191
"#{src}"
190192
when AST::DatePrimitiveType
191193
"apiInternal.encodeDate(date: #{src})"

0 commit comments

Comments
 (0)