1.1 --- a/generator.py Sat Mar 25 23:06:55 2017 +0100
1.2 +++ b/generator.py Sat Mar 25 23:20:16 2017 +0100
1.3 @@ -42,10 +42,13 @@
1.4
1.5 # NOTE: These must be synchronised with the library.
1.6
1.7 + dict_type = "__builtins__.dict.dict"
1.8 function_type = "__builtins__.core.function"
1.9 int_type = "__builtins__.int.int"
1.10 + list_type = "__builtins__.list.list"
1.11 none_type = "__builtins__.none.NoneType"
1.12 string_type = "__builtins__.str.string"
1.13 + tuple_type = "__builtins__.tuple.tuple"
1.14 type_type = "__builtins__.core.type"
1.15 unicode_type = "__builtins__.unicode.utf8string"
1.16
1.17 @@ -58,17 +61,10 @@
1.18 ("__builtins__.notimplemented", "NotImplemented"),
1.19 )
1.20
1.21 - literal_mapping_types = (
1.22 - "__builtins__.dict.dict",
1.23 + literal_instantiator_types = (
1.24 + dict_type, list_type, tuple_type
1.25 )
1.26
1.27 - literal_sequence_types = (
1.28 - "__builtins__.list.list",
1.29 - "__builtins__.tuple.tuple",
1.30 - )
1.31 -
1.32 - literal_instantiator_types = literal_mapping_types + literal_sequence_types
1.33 -
1.34 def __init__(self, importer, optimiser, output):
1.35
1.36 """
1.37 @@ -1247,15 +1243,11 @@
1.38 # Signature: __newliteral_sequence(ARGS, NUM)
1.39
1.40 if path in self.literal_instantiator_types:
1.41 - if path in self.literal_mapping_types:
1.42 - style = "mapping"
1.43 - else:
1.44 - style = "sequence"
1.45 + style = path.rsplit(".", 1)[-1]
1.46
1.47 - print >>f_signatures, "#define %s(ARGS, NUM) (%s(__NEWINSTANCE(%s), ARGS, NUM))" % (
1.48 + print >>f_signatures, "#define %s(ARGS, NUM) (%s(ARGS, NUM))" % (
1.49 encode_literal_instantiator(path),
1.50 encode_literal_data_initialiser(style),
1.51 - encode_path(path)
1.52 )
1.53
1.54 def write_main_program(self, f_code, f_signatures):