Fixed crash on failed lookup of goto/call/etc target.
authorthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Mon, 12 May 2008 23:25:01 +0000 (23:25 +0000)
committerthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Mon, 12 May 2008 23:25:01 +0000 (23:25 +0000)
git-svn-id: http://svn.complang.org/ragel/trunk@451 052ea7fc-9027-0410-9066-f65837a77df0

CREDITS
ragel/parsedata.cpp

diff --git a/CREDITS b/CREDITS
index 75a6e0c..d5c2214 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -36,4 +36,5 @@ missed.
     Marcus Rueckert, Jeremy Hinegardner, Aaron Campbell, Josh Purinton,
     Judson Lester, Barry Arthur, Tim Potter, Ryan Phelps, David Waite,
     Kenny MacDermid, MenTaLguY, Manoj Rajagopalan, Tim Chklovski,
-    Mikkel Fahnøe Jørgensen, Andrei Polushin, Evan Phoenix, David Balmain
+    Mikkel Fahnøe Jørgensen, Andrei Polushin, Evan Phoenix, David Balmain,
+    Ross Thomas
index 09c29ef..6e2558b 100644 (file)
@@ -735,21 +735,25 @@ void ParseData::resolveNameRefs( InlineList *inlineList, Action *action )
                                /* Resolve, pass action for local search. */
                                NameInst *target = resolveStateRef( *item->nameRef, item->loc, action );
 
-                               /* Check if the target goes into a longest match. */
-                               NameInst *search = target->parent;
-                               while ( search != 0 ) {
-                                       if ( search->isLongestMatch ) {
-                                               error(item->loc) << "cannot enter inside a longest "
-                                                               "match construction as an entry point" << endl;
-                                               break;
+                               /* Name lookup error reporting is handled by resolveStateRef. */
+                               if ( target != 0 ) {
+                                       /* Check if the target goes into a longest match. */
+                                       NameInst *search = target->parent;
+                                       while ( search != 0 ) {
+                                               if ( search->isLongestMatch ) {
+                                                       error(item->loc) << "cannot enter inside a longest "
+                                                                       "match construction as an entry point" << endl;
+                                                       break;
+                                               }
+                                               search = search->parent;
                                        }
-                                       search = search->parent;
-                               }
 
-                               /* Note the reference in the name. This will cause the entry
-                                * point to survive to the end of the graph generating walk. */
-                               if ( target != 0 )
+                                       /* Record the reference in the name. This will cause the
+                                        * entry point to survive to the end of the graph
+                                        * generating walk. */
                                        target->numRefs += 1;
+                               }
+
                                item->nameTarg = target;
                                break;
                        }