From 9ab5e6b618589067326b5b8f8f9e8913e2371efb Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Fri, 18 Apr 2014 06:54:19 -0500 Subject: [PATCH] fix a non-buggy set!-before-initialization in syntax-browser What appears to be happening is that the fields path and next-push are state variables on this class that are initialized and then used only during the dynamic-extent of syntax-object->datum/record-paths and of the pretty-printing code. So, before the check was in place, they were initialized and used before the 'path' field was initialized, but by the time the path field was initialized, the value was junk (not going to be used again) but it still raised an error original commit: 34abe306e34e038bb3e6504f6203db3f85a913a2 --- pkgs/gui-pkgs/gui-lib/mrlib/syntax-browser.rkt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/gui-pkgs/gui-lib/mrlib/syntax-browser.rkt b/pkgs/gui-pkgs/gui-lib/mrlib/syntax-browser.rkt index 4e9681ca..b4017710 100644 --- a/pkgs/gui-pkgs/gui-lib/mrlib/syntax-browser.rkt +++ b/pkgs/gui-pkgs/gui-lib/mrlib/syntax-browser.rkt @@ -69,6 +69,8 @@ needed to really make this work: (define/override (write stream) (send stream put (string->bytes/utf-8 (format "~s" (marshall-syntax main-stx))))) + (define path '()) + (define next-push 0) (define-values (datum paths-ht) (syntax-object->datum/record-paths main-stx)) (define output-text (new text:hide-caret/selection%)) @@ -88,8 +90,6 @@ needed to really make this work: 0 (send text last-position))) - (define path '()) - (define next-push 0) (define/private (push!) (set! path (cons next-push path)) (set! next-push 0))