--- ../orig/types.c Wed Feb 16 04:15:03 2005 +++ ./types.c Thu Feb 24 02:43:21 2005 @@ -873,18 +873,9 @@ { case TREE_LIST: for (; t; t = TREE_CHAIN (t)) - { - /* @@ This doesn't strictly belong here. As long as the function is - only called from build_schema_type, it probably doesn't matter, - and it's easier than another pass. */ - tree p = TREE_PURPOSE (t); - if (p && TREE_CODE (p) == IDENTIFIER_NODE) - p = TREE_PURPOSE (t) = check_identifier (p); - - if ((TREE_VALUE (t) && has_side_effects (TREE_VALUE (t), 0)) - || (p && has_side_effects (p, 0))) - return 1; - } + if ((TREE_VALUE (t) && has_side_effects (TREE_VALUE (t), 0)) + || (TREE_PURPOSE (t) && has_side_effects (TREE_PURPOSE (t), 0))) + return 1; return 0; case VAR_DECL: @@ -928,22 +919,26 @@ { tree fields = NULL_TREE, d, tmp, t; chk_dialect ("schema types are", E_O_M_PASCAL); - for (d = discriminants; d; d = TREE_CHAIN (d)) - fields = chainon (fields, build_field (DECL_NAME (TREE_VALUE (d)), TREE_TYPE (TREE_VALUE (d)))); + if (init && check_pascal_initializer (type, init)) + { + error ("invalid initializer"); + init = NULL_TREE; + } if (!init && !EM (type)) init = TYPE_GET_INITIALIZER (type); - fields = chainon (fields, build_field (schema_id, type)); - for (t = fields; t && !has_side_effects (TREE_TYPE (t), 0); t = TREE_CHAIN (t)) ; - if (t || (init && has_side_effects (init, 0))) - error ("expressions with side-effects are not allowed in schema types"); /* Release the identifiers of the discriminants. We must do this also in case - of a previous error, but has_side_effects still needs them! */ + of a previous error, but check_pascal_initializer still needs them! */ for (d = discriminants; d; d = TREE_CHAIN (d)) { tree id = DECL_NAME (TREE_VALUE (d)); + fields = chainon (fields, build_field (id, TREE_TYPE (TREE_VALUE (d)))); IDENTIFIER_VALUE (id) = TREE_PURPOSE (d); } /* Do not return before this point! */ + fields = chainon (fields, build_field (schema_id, type)); + for (t = fields; t && !has_side_effects (TREE_TYPE (t), 0); t = TREE_CHAIN (t)) ; + if (t || (init && has_side_effects (init, 0))) + error ("expressions with side-effects are not allowed in schema types"); CHK_EM (type); t = finish_struct (start_struct (RECORD_TYPE), fields, 1); CHK_EM (t); @@ -1235,7 +1230,7 @@ if (f && (ti = TYPE_GET_INITIALIZER (TREE_TYPE (f)))) { assert (TREE_CODE (ti) == TREE_LIST && !TREE_PURPOSE (ti)); - init = tree_cons (build_tree_list (DECL_NAME (f), NULL_TREE), TREE_VALUE (ti), init); + init = chainon (init, TREE_VALUE (ti)); } } }