2024-10-16 00:29 AEDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000318mercuryBugpublic2015-10-29 15:23
Reporterwangp 
Assigned Tozs 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000318: pragma foreign_type depends on item order
DescriptionAn error is reported for a pragma foreign_type if the type name is not declared earlier.
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0000646

juliensf (administrator)

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.

~0000647

juliensf (administrator)

Actually, there's another solution to this, we could allow foreign_type pragmas to act as type declarations.

~0000653

zs (developer)

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.

~0000857

zs (developer)

Fix committed 2015 oct 29.
+Notes

-Issue History
Date Modified Username Field Change
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
+Issue History