Corrected bug in initializing an array with { }

svn: r2827
This commit is contained in:
Kathy Gray 2006-04-27 21:47:30 +00:00
parent 9965629bde
commit 7c4c832269
4 changed files with 15 additions and 5 deletions

View File

@ -855,7 +855,7 @@
(let ((new-type/env (check-e (car exps) env)))
(unless (assignment-conversion dec-type (type/env-t new-type/env) type-recs)
(array-init-error dec-type (type/env-t new-type/env) (expr-src (car exps))))
(loop (cdr exps) (type/env-t new-type/env)))))))))
(loop (cdr exps) (type/env-e new-type/env)))))))))
;check-array-init-sub-inits: (list array-init) (exp env -> type/env) env type type-records -> type/env
(define (check-array-init-sub-inits inits check-e env type type-recs)

View File

@ -135,9 +135,13 @@
(parse-statement null first-tok 'start getter #t #f #f))
((IDENTIFIER)
(let ((next (getter)))
(if (id-token? (get-tok next))
(parse-statement first-tok next 'local getter #t #f #f)
(parse-expression first-tok next 'name getter #t #f))))
(cond
((id-token? (get-tok next))
(parse-statement first-tok next 'local getter #t #f #f))
((o-bracket? (get-tok next))
(parse-statement first-tok next 'local getter #t #f #f))
(else
(parse-expression first-tok next 'name getter #t #f)))))
(else
(if (prim-type? (get-tok first-tok))
(parse-statement null first-tok 'start getter #t #f #f)

View File

@ -637,7 +637,7 @@
(assignable (filter (lambda (mr)
(andmap a-convert? (m-atypes mr) arg-types))
methods))
;(sort (lambda (l p) (quicksort l p)))
(sort (lambda (l p) (quicksort l p)))
(assignable-count (sort
(map (lambda (mr)
(list (number-assign-conversions arg-types (m-atypes mr) type-recs)

View File

@ -381,6 +381,12 @@ class WeeklyPlanner{
(list 2)
"Test of private field access")
(interact-test
'advanced
(list "String[] a = {new String(\"hi\"),new String(\"i\")};")
(list '(void))
"Test of array init")
(report-test-results)
)