aboutsummaryrefslogtreecommitdiff
path: root/src/guile/skribilo/ast.scm
diff options
context:
space:
mode:
authorLudovic Courtes2006-02-28 21:40:26 +0000
committerLudovic Courtes2006-02-28 21:40:26 +0000
commitbc9090d69ebe3c2612efd830b859d4c1c896aae0 (patch)
treef22905d7e16b7a76624e1def45e7491ba708d969 /src/guile/skribilo/ast.scm
parent9c00c232438cb83430397080e1c810aa33da460a (diff)
downloadskribilo-bc9090d69ebe3c2612efd830b859d4c1c896aae0.tar.gz
skribilo-bc9090d69ebe3c2612efd830b859d4c1c896aae0.tar.lz
skribilo-bc9090d69ebe3c2612efd830b859d4c1c896aae0.zip
Slightly optimized the resolution process (added `ast-resolved?').
* src/guile/skribilo/ast.scm (<ast>): Added a `resolved?' slot, with accessor `ast-resolved?'. * src/guile/skribilo/resolve.scm (do-resolve!)[<node>]: Check whether `ast-resolved?' is true and set it once it's resolved. git-archimport-id: lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2--patch-37
Diffstat (limited to 'src/guile/skribilo/ast.scm')
-rw-r--r--src/guile/skribilo/ast.scm13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/guile/skribilo/ast.scm b/src/guile/skribilo/ast.scm
index 1856389..3968b18 100644
--- a/src/guile/skribilo/ast.scm
+++ b/src/guile/skribilo/ast.scm
@@ -25,6 +25,7 @@
:use-module (skribilo utils syntax)
:export (<ast> ast? ast-loc ast-loc-set!
ast-parent ast->string ast->file-location
+ ast-resolved?
<command> command? command-fmt command-body
<unresolved> unresolved? unresolved-proc
@@ -71,8 +72,16 @@
;;; ======================================================================
;;FIXME: set! location in <ast>
(define-class <ast> ()
- (parent :accessor ast-parent :init-keyword :parent :init-value 'unspecified)
- (loc :init-value #f))
+ ;; Parent of this guy.
+ (parent :accessor ast-parent :init-keyword :parent :init-value 'unspecified)
+
+ ;; Its source location.
+ (loc :init-value #f)
+
+ ;; This slot is used as an optimization when resolving an AST: sub-parts of
+ ;; the tree are marked as resolved as soon as they are and don't need to be
+ ;; traversed again.
+ (resolved? :accessor ast-resolved? :init-value #f))
(define (ast? obj) (is-a? obj <ast>))