- added identifier? checks to detect attempts to use non-identifier
field names in define-record-type field specs. syntax.ss, record.ms, root-experr* original commit: be022d947b3831afcb4c538151899f9bd6559615
This commit is contained in:
parent
9aa1fc4caa
commit
30934965f3
4
LOG
4
LOG
|
@ -901,3 +901,7 @@
|
|||
8.ms, syntax.ss, release_notes.stex
|
||||
- add collect-rendezvous
|
||||
prim.c, 7.ss, primdata.ss, 7.ms, smgmt.stex, release_notes.stex
|
||||
- added identifier? checks to detect attempts to use non-identifier
|
||||
field names in define-record-type field specs.
|
||||
syntax.ss,
|
||||
record.ms, root-experr*
|
||||
|
|
|
@ -8607,6 +8607,24 @@
|
|||
(if b
|
||||
(#3%$object-ref 'scheme-object 'x ,fixnum?)
|
||||
72)))
|
||||
; ensure we're checking to make sure field names, accessors, and
|
||||
; mutators are identifiers
|
||||
(error? ; invalid field spec
|
||||
(define-record-type foo (fields 876)))
|
||||
(error? ; invalid field spec
|
||||
(define-record-type foo (fields (mutable (x)))))
|
||||
(error? ; invalid field spec
|
||||
(define-record-type foo (fields (immutable "spam"))))
|
||||
(error? ; invalid field spec
|
||||
(define-record-type foo (fields (immutable (x) foo-x))))
|
||||
(error? ; invalid accessor name
|
||||
(define-record-type foo (fields (immutable x (foo-x)))))
|
||||
(error? ; invalid field spec
|
||||
(define-record-type foo (fields (mutable (x) foo-x foo-x!))))
|
||||
(error? ; invalid accessor name
|
||||
(define-record-type foo (fields (mutable x (foo-x) foo-x!))))
|
||||
(error? ; invalid accessor name
|
||||
(define-record-type foo (fields (mutable x foo-x (foo-x!)))))
|
||||
)
|
||||
|
||||
(mat define-record-type-extensions
|
||||
|
|
|
@ -7453,6 +7453,14 @@ record.mo:Expected error in mat r6rs-records-syntactic: "invalid define-record-t
|
|||
record.mo:Expected error in mat r6rs-records-syntactic: "no constructor descriptor for define-record record type frob".
|
||||
record.mo:Expected error in mat r6rs-records-syntactic: "define-record-type: invalid protocol oops".
|
||||
record.mo:Expected error in mat r6rs-records-syntactic: "parent record type is sealed prnt".
|
||||
record.mo:Expected error in mat r6rs-records-syntactic: "invalid field specifier 876".
|
||||
record.mo:Expected error in mat r6rs-records-syntactic: "invalid field specifier (mutable (x))".
|
||||
record.mo:Expected error in mat r6rs-records-syntactic: "invalid field specifier (immutable "spam")".
|
||||
record.mo:Expected error in mat r6rs-records-syntactic: "invalid field specifier (immutable (x) foo-x)".
|
||||
record.mo:Expected error in mat r6rs-records-syntactic: "invalid field specifier (immutable x (foo-x))".
|
||||
record.mo:Expected error in mat r6rs-records-syntactic: "invalid field specifier (mutable (x) foo-x foo-x!)".
|
||||
record.mo:Expected error in mat r6rs-records-syntactic: "invalid field specifier (mutable x (foo-x) foo-x!)".
|
||||
record.mo:Expected error in mat r6rs-records-syntactic: "invalid field specifier (mutable x foo-x (foo-x!))".
|
||||
record.mo:Expected error in mat define-record-type-extensions: "missing nongenerative clause and require-nongenerative-clause is #t (define-record-type foo)".
|
||||
record.mo:Expected error in mat cp0-record-ref-optimizations: "make-record-type-descriptor: invalid uid 5".
|
||||
hash.mo:Expected error in mat old-hash-table: "get-hash-table: ((a . b)) is not an eq hashtable".
|
||||
|
|
|
@ -7453,6 +7453,14 @@ record.mo:Expected error in mat r6rs-records-syntactic: "invalid define-record-t
|
|||
record.mo:Expected error in mat r6rs-records-syntactic: "no constructor descriptor for define-record record type frob".
|
||||
record.mo:Expected error in mat r6rs-records-syntactic: "define-record-type: invalid protocol oops".
|
||||
record.mo:Expected error in mat r6rs-records-syntactic: "parent record type is sealed prnt".
|
||||
record.mo:Expected error in mat r6rs-records-syntactic: "invalid field specifier 876".
|
||||
record.mo:Expected error in mat r6rs-records-syntactic: "invalid field specifier (mutable (x))".
|
||||
record.mo:Expected error in mat r6rs-records-syntactic: "invalid field specifier (immutable "spam")".
|
||||
record.mo:Expected error in mat r6rs-records-syntactic: "invalid field specifier (immutable (x) foo-x)".
|
||||
record.mo:Expected error in mat r6rs-records-syntactic: "invalid field specifier (immutable x (foo-x))".
|
||||
record.mo:Expected error in mat r6rs-records-syntactic: "invalid field specifier (mutable (x) foo-x foo-x!)".
|
||||
record.mo:Expected error in mat r6rs-records-syntactic: "invalid field specifier (mutable x (foo-x) foo-x!)".
|
||||
record.mo:Expected error in mat r6rs-records-syntactic: "invalid field specifier (mutable x foo-x (foo-x!))".
|
||||
record.mo:Expected error in mat define-record-type-extensions: "missing nongenerative clause and require-nongenerative-clause is #t (define-record-type foo)".
|
||||
record.mo:Expected error in mat cp0-record-ref-optimizations: "make-record-type-descriptor: invalid uid 5".
|
||||
hash.mo:Expected error in mat old-hash-table: "get-hash-table: ((a . b)) is not an eq hashtable".
|
||||
|
|
|
@ -9299,6 +9299,7 @@
|
|||
(define (parse-field x i)
|
||||
(syntax-case x (immutable mutable)
|
||||
[(immutable field-name accessor-name)
|
||||
(and (identifier? #'field-name) (identifier? #'accessor-name))
|
||||
(make-field-desc
|
||||
(datum field-name)
|
||||
i
|
||||
|
@ -9306,6 +9307,7 @@
|
|||
#'accessor-name
|
||||
#f)]
|
||||
[(mutable field-name accessor-name mutator-name)
|
||||
(and (identifier? #'field-name) (identifier? #'accessor-name) (identifier? #'mutator-name))
|
||||
(make-field-desc
|
||||
(datum field-name)
|
||||
i
|
||||
|
@ -9313,10 +9315,12 @@
|
|||
#'accessor-name
|
||||
#'mutator-name)]
|
||||
[(immutable field-name)
|
||||
(identifier? #'field-name)
|
||||
(make-field-desc (datum field-name) i x
|
||||
(construct-name name name "-" #'field-name)
|
||||
#f)]
|
||||
[(mutable field-name)
|
||||
(identifier? #'field-name)
|
||||
(make-field-desc (datum field-name) i x
|
||||
(construct-name name name "-" #'field-name)
|
||||
(construct-name name name "-" #'field-name "-set!"))]
|
||||
|
|
Loading…
Reference in New Issue
Block a user