From 1dbf3e8477f4959c390bda59824d37836d53a1d7 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Fri, 10 Jun 2011 17:29:34 +0200 Subject: [PATCH] Minimal comment for visit.rs --- src/comp/middle/visit.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/comp/middle/visit.rs b/src/comp/middle/visit.rs index bc0740d9fb78..0d7db393cd0d 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; } }