File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 318318 (check-unique-label-decls p)
319319 (check-label-targets-declared p)
320320 (check-has-initial-label p)
321+ (check-initial-label-global p)
321322 ;; anything else?
322323 p))
323324
383384(define (check-has-initial-label asm)
384385 (unless (findf Label? asm)
385386 (error 'prog "no initial label found " )))
387+
388+ ;; Asm -> Void
389+ (define (check-initial-label-global asm)
390+ (match (findf Label? asm)
391+ [(Label init )
392+ (unless (member init (map (lambda (i) (match i [(Global l) l]))
393+ (filter Global? asm)))
394+ (error 'prog "initial label undeclared as global: ~v " init ))]))
Original file line number Diff line number Diff line change 2020(check-not-exn (thunk (Add 'rax (sub1 (expt 2 32 )))))
2121(check-exn exn:fail? (thunk (Sub 'rax (expt 2 32 ))))
2222(check-not-exn (thunk (Sub 'rax (sub1 (expt 2 32 )))))
23+
24+ ;; Check prog
25+ (check-exn exn:fail? (thunk (prog (Ret))))
26+ (check-exn exn:fail? (thunk (prog (Label 'start ) (Ret))))
27+ (check-exn exn:fail? (thunk (prog (Global 'foo ) (Label 'start ) (Label 'foo ) (Ret))))
28+ (check-not-exn (thunk (prog (Global 'start ) (Label 'start ) (Ret))))
29+ (check-not-exn (thunk (prog (Label 'start ) (Ret) (Global 'start ))))
30+
31+
You can’t perform that action at this time.
0 commit comments