|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000318||mercury||Bug||public||2014-02-13 11:31||2015-10-29 15:23|
|Target Version||Fixed in Version|
|Summary||0000318: pragma foreign_type depends on item order|
|Description||An error is reported for a pragma foreign_type if the type name is not declared earlier.|
|Tags||No tags attached.|
That happens because type declarations and pragmas are added to the HLDS during the same pass.
One solution would be to add all the type declarations before adding all the pragmas; the disadvantage of that approach is that it would require another traversal of the parse tree during parse tree -> hlds conversion.
|Actually, there's another solution to this, we could allow foreign_type pragmas to act as type declarations.|
I think the right solution is to away with the notion of "passes" over the item list altogether.
I think the one and only pass over the item list should construct a set of cords; one cord for type declarations, one for inst declarations, one for mode declarations, one for pred declarations and so on. Once those cords have been converted to lists, the rest of the code should then process those lists
in the order that their dependencies dictate. One of those dictates would be the need to process type declarations before processing foreign type pragmas.
The main complication is that at the moment, the import status of each item is effectively implicit in the position of the item with respect to status markers in the item list, and the exact details of that dependence are not well documented. Most of those details are obvious, but some are not.
|Fix committed 2015 oct 29.|
|2014-02-13 11:31||wangp||New Issue|
|2014-02-13 11:31||wangp||File Added: foreign.m|
|2014-02-13 14:41||juliensf||Note Added: 0000646|
|2014-02-13 19:31||juliensf||Note Added: 0000647|
|2014-03-03 14:13||zs||Note Added: 0000653|
|2015-10-29 15:23||zs||Note Added: 0000857|
|2015-10-29 15:23||zs||Status||new => resolved|
|2015-10-29 15:23||zs||Resolution||open => fixed|
|2015-10-29 15:23||zs||Assigned To||=> zs|