Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clean-compiler-and-rts
compiler
Commits
44f0f49b
Commit
44f0f49b
authored
Apr 03, 2014
by
John van Groningen
Browse files
use the index to recognize predefined types when printing, instead of the name of the types
parent
5606eb3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
frontend/typesupport.icl
View file @
44f0f49b
...
...
@@ -1289,31 +1289,32 @@ where
writeTypeTA
::
!*
File
!(
Optional
TypeVarBeautifulizer
)
!
Format
!
TypeSymbIdent
!
a
->
(!*
File
,
!
Optional
TypeVarBeautifulizer
)
|
writeType
a
writeTypeTA
file
opt_beautifulizer
form
{
type_ident
,
type_index
,
type_arity
}
types
|
is_predefined
type_index
|
type_ident
.
id_name
==
"_List"
|
type_index
.
glob_module
==
cPredefinedModuleIndex
#
predef_index
=
type_index
.
glob_object
+
FirstTypePredefinedSymbolIndex
|
type_arity
==
0
|
predef_index
==
PD_StringType
=
(
file
<<<
"String"
,
opt_beautifulizer
)
=
(
file
<<<
type_ident
,
opt_beautifulizer
)
|
predef_index
==
PD_ListType
=
writeWithinBrackets
"["
"]"
file
opt_beautifulizer
(
setProperty
form
cCommaSeparator
,
types
)
|
type_ident
.
id_name
==
"_!List"
|
predef_index
==
PD_StrictListType
=
writeWithinBrackets
"[!"
"]"
file
opt_beautifulizer
(
setProperty
form
cCommaSeparator
,
types
)
|
type_ident
.
id_name
==
"_#List"
|
predef_index
==
PD_UnboxedListType
=
writeWithinBrackets
"[#"
"]"
file
opt_beautifulizer
(
setProperty
form
cCommaSeparator
,
types
)
|
type_ident
.
id_name
==
"_List!"
|
predef_index
==
PD_TailStrictListType
=
writeWithinBrackets
"["
"!]"
file
opt_beautifulizer
(
setProperty
form
cCommaSeparator
,
types
)
|
type_ident
.
id_name
==
"_!List!"
|
predef_index
==
PD_StrictTailStrictListType
=
writeWithinBrackets
"[!"
"!]"
file
opt_beautifulizer
(
setProperty
form
cCommaSeparator
,
types
)
|
type_ident
.
id_name
==
"_#List!"
|
predef_index
==
PD_UnboxedTailStrictListType
=
writeWithinBrackets
"[#"
"!]"
file
opt_beautifulizer
(
setProperty
form
cCommaSeparator
,
types
)
|
is_l
azy
_a
rray
t
ype
_ident
|
predef_index
==
PD_L
azy
A
rray
T
ype
=
writeWithinBrackets
"{"
"}"
file
opt_beautifulizer
(
setProperty
form
cCommaSeparator
,
types
)
|
is_s
trict
_a
rray
t
ype
_ident
|
predef_index
==
PD_S
trict
A
rray
T
ype
=
writeWithinBrackets
"{!"
"}"
file
opt_beautifulizer
(
setProperty
form
cCommaSeparator
,
types
)
|
is_u
nboxed
_a
rray
t
ype
_ident
|
predef_index
==
PD_U
nboxed
A
rray
T
ype
=
writeWithinBrackets
"{#"
"}"
file
opt_beautifulizer
(
setProperty
form
cCommaSeparator
,
types
)
|
is_t
uple
t
ype_ide
nt
type_arity
|
predef_index
>=
PD_Arity2T
uple
T
ype
&&
predef
_i
n
de
x
<=
PD_Arity32TupleType
=
writeWithinBrackets
"("
")"
file
opt_beautifulizer
(
setProperty
form
cCommaSeparator
,
types
)
|
is_string_type
type_ident
=
(
file
<<<
"String"
,
opt_beautifulizer
)
|
type_arity
==
0
=
(
file
<<<
type_ident
,
opt_beautifulizer
)
|
checkProperty
form
cBrackets
#
(
file
,
opt_beautifulizer
)
=
writeType
(
file
<<<
'('
<<<
type_ident
<<<
' '
)
opt_beautifulizer
(
form
,
types
)
...
...
@@ -1326,14 +1327,6 @@ writeTypeTA file opt_beautifulizer form {type_ident,type_index,type_arity} types
=
writeType
(
file
<<<
'('
<<<
type_ident
<<<
' '
)
opt_beautifulizer
(
form
,
types
)
=
(
file
<<<
')'
,
opt_beautifulizer
)
=
writeType
(
file
<<<
type_ident
<<<
' '
)
opt_beautifulizer
(
setProperty
form
cBrackets
,
types
)
where
is_predefined
{
glob_module
}
=
glob_module
==
cPredefinedModuleIndex
is_tuple
{
id_name
}
tup_arity
=
id_name
==
"_Tuple"
+++
toString
tup_arity
is_lazy_array
{
id_name
}
=
id_name
==
"_Array"
is_strict_array
{
id_name
}
=
id_name
==
"_!Array"
is_unboxed_array
{
id_name
}
=
id_name
==
"_#Array"
is_string_type
{
id_name
}
=
id_name
==
"_String"
instance
writeType
ATypeVar
where
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment