Appearance
| 1 | namespace Semantic.Symbols is | |
| 2 | use Compiler | |
| 3 | use IoC | |
| 4 | use Source | |
| 5 | ||
| 6 | // The per-cell view a session compiles each cell against. A cell's | |
| 7 | // code was written against the cells before it, so an alternative a | |
| 8 | // later cell declares is invisible to the closed-hierarchy decisions | |
| 9 | // of an earlier cell's code; what those decisions could not see is | |
| 10 | // carried by the guards a session emits. An ordinary build, and any | |
| 11 | // file that is not a cell, sees everything. | |
| 12 | class SESSION_VIEW is | |
| 13 | // Whether `alternative`, a member of a closed root's in-set, is | |
| 14 | // part of the hierarchy as the code at `site` was compiled | |
| 15 | // against it: declared in a cell no later than the site's own, | |
| 16 | // or not declared in a cell at all. | |
| 17 | is_visible(alternative: Classy, site: LOCATION) -> bool static is | |
| 18 | let flags = IoC.CONTAINER.instance.build_flags | |
| 19 | ||
| 20 | if !flags.want_session then | |
| 21 | return true | |
| 22 | fi | |
| 23 | ||
| 24 | let alternative_cell = flags.session_cell_at(alternative.location.file_name) | |
| 25 | ||
| 26 | if !alternative_cell? then | |
| 27 | return true | |
| 28 | fi | |
| 29 | ||
| 30 | let site_cell = flags.session_cell_at(site.file_name) | |
| 31 | ||
| 32 | if !site_cell? then | |
| 33 | return true | |
| 34 | fi | |
| 35 | ||
| 36 | return alternative_cell <= site_cell | |
| 37 | si | |
| 38 | si | |
| 39 | si |