diff options
author | johnvg | 2014-04-03 13:05:51 +0000 |
---|---|---|
committer | johnvg | 2014-04-03 13:05:51 +0000 |
commit | 5aa3493c0ae94e8f628583333df2b9d768befc62 (patch) | |
tree | 9505d76888af4591439c2d53a02bee5caac2c7ce /frontend | |
parent | fix the order of expansion of type synonyms in type synonyms, (diff) |
use the index to recognize predefined types when printing, instead of the name of the types
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@2364 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/typesupport.icl | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/frontend/typesupport.icl b/frontend/typesupport.icl index 1bc3eaf..34cbf7e 100644 --- a/frontend/typesupport.icl +++ b/frontend/typesupport.icl @@ -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_lazy_array type_ident + | predef_index==PD_LazyArrayType = writeWithinBrackets "{" "}" file opt_beautifulizer (setProperty form cCommaSeparator, types) - | is_strict_array type_ident + | predef_index==PD_StrictArrayType = writeWithinBrackets "{!" "}" file opt_beautifulizer (setProperty form cCommaSeparator, types) - | is_unboxed_array type_ident + | predef_index==PD_UnboxedArrayType = writeWithinBrackets "{#" "}" file opt_beautifulizer (setProperty form cCommaSeparator, types) - | is_tuple type_ident type_arity + | predef_index>=PD_Arity2TupleType && predef_index<=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 |