diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2011-06-10 17:29:34 +0200 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2011-06-10 17:29:34 +0200 |
| commit | 1dbf3e8477f4959c390bda59824d37836d53a1d7 (patch) | |
| tree | c98630822bb657735176de36e13149b7bbab159a /src/comp | |
| parent | 97576bd14995705eea1dea6cfe21295f91aa358d (diff) | |
Minimal comment for visit.rs
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/middle/visit.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/comp/middle/visit.rs b/src/comp/middle/visit.rs index bc0740d9fb7..0d7db393cd0 100644 --- a/src/comp/middle/visit.rs +++ b/src/comp/middle/visit.rs @@ -4,9 +4,15 @@ import std::option::some; import std::option::none; import util::common::span; +// Context-passing AST walker. Each overridden visit method has full control +// over what happens with its node, it can do its own traversal of the node's +// children (potentially passing in different contexts to each), call +// visit::visit_* to apply the default traversal algorithm (again, it can +// override the context), or prevent deeper traversal by doing nothing. + // Lots of redundant indirection and refcounting. Our typesystem doesn't do // circular types, so the visitor record can not hold functions that take -// visitors. A tag breaks the cycle. +// visitors. A vt tag is used to break the cycle. tag vt[E] { vtor(visitor[E]); } fn vt[E](&vt[E] x) -> visitor[E] { alt (x) { case (vtor(?v)) { ret v; } } |
