the NAME operator now checks to make sure its operand is a variable
authorMark Linton <linton@ucbvax.Berkeley.EDU>
Thu, 18 Feb 1982 10:54:02 +0000 (02:54 -0800)
committerMark Linton <linton@ucbvax.Berkeley.EDU>
Thu, 18 Feb 1982 10:54:02 +0000 (02:54 -0800)
SCCS-vsn: usr.bin/pascal/pdx/tree/eval.c 1.4

usr/src/usr.bin/pascal/pdx/tree/eval.c

index 826cdd1..cbac659 100644 (file)
@@ -1,6 +1,6 @@
 /* Copyright (c) 1982 Regents of the University of California */
 
 /* Copyright (c) 1982 Regents of the University of California */
 
-static char sccsid[] = "@(#)eval.c 1.3 %G%";
+static char sccsid[] = "@(#)eval.c 1.4 %G%";
 
 /*
  * Parse tree evaluation.
 
 /*
  * Parse tree evaluation.
@@ -60,11 +60,15 @@ register NODE *p;
            SYM *s, *f;
 
            s = p->nameval;
            SYM *s, *f;
 
            s = p->nameval;
-           f = container(s);
-           if (!isactive(f)) {
-               error("\"%s\" is not active", name(f));
+           if (!isvariable(s)) {
+               error("cannot evaluate a %s", classname(s));
+           } else {
+               f = container(s);
+               if (!isactive(f)) {
+                   error("\"%s\" is not active", name(f));
+               }
+               push(int, address(s, NIL));
            }
            }
-           push(int, address(s, NIL));
            break;
        }
 
            break;
        }