chiark / gitweb /
src/class-utilities.lisp: Permit `temporary-name' objects as class names.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 8 Jun 2018 18:58:28 +0000 (19:58 +0100)
This will be helpful in error recovery.  Classes and various related
objects must have names, but if we can't parse the user's choice of name
then we have to make one up.  The easy approach, to avoid conflicts with
the user's other choices, is to pick a name with funny characters in,
but that's properly rejected by the check here; but we can wrap the name
up in a `temporary-name' object to push it through without trouble.

src/class-utilities.lisp

index 5b3021f8e414a927682ba0a078e322a7023714d3..a26afd29b9695fbac1fd96293bbd2dfef7f7b2b1 100644 (file)
@@ -173,11 +173,12 @@ (defun valid-name-p (name)
      * all of whose characters are alphanumeric or underscores
      * and which doesn't contain two consecutive underscores."
 
-  (and (stringp name)
-       (plusp (length name))
-       (alpha-char-p (char name 0))
-       (every (lambda (ch) (or (alphanumericp ch) (char= ch #\_))) name)
-       (not (search "__" name))))
+  (or (typep name 'temporary-variable)
+      (and (stringp name)
+          (plusp (length name))
+          (alpha-char-p (char name 0))
+          (every (lambda (ch) (or (alphanumericp ch) (char= ch #\_))) name)
+          (not (search "__" name)))))
 
 (export 'find-root-superclass)
 (defun find-root-superclass (class)