Skip to content

Commit e1f19e3

Browse files
committed
propagate other method metadata as well
1 parent b0392dc commit e1f19e3

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

src/ast.scm

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,20 @@
523523
(and (if one (length= e 3) (length> e 2))
524524
(eq? (car e) 'meta) (memq (cadr e) '(nospecialize specialize))))
525525

526-
(define (inline-meta? e)
527-
(and (length= e 2)
528-
(eq? (car e) 'meta) (memq (cadr e) '(inline noinline))))
526+
(define (meta? e)
527+
(and (length> e 1) (eq? (car e) 'meta)))
528+
529+
(define (method-meta-sym? x)
530+
(memq x '(inline noinline aggressive_constprop no_constprop propagate_inbounds)))
531+
532+
(define (propagate-method-meta e)
533+
`(meta ,@(filter (lambda (x)
534+
(or (method-meta-sym? x)
535+
(and (pair? x) (eq? (car x) 'purity))))
536+
(cdr e))))
537+
538+
(define (argwide-nospecialize-meta? e)
539+
(and (length= e 2) (eq? (car e) 'meta) (memq (cadr e) '(nospecialize specialize))))
529540

530541
(define (if-generated? e)
531542
(and (length= e 4) (eq? (car e) 'if) (equal? (cadr e) '(generated))))

src/julia-syntax.scm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,9 @@
562562
,(if (any kwarg? pargl) (gensy) UNUSED)
563563
(call (core kwftype) ,ftype)) ,kw ,@pargl ,@vararg)
564564
`(block
565-
,@(filter inline-meta? prologue)
565+
;; propagate method metadata to keyword sorter
566+
,@(map propagate-method-meta (filter meta? prologue))
567+
,@(filter argwide-nospecialize-meta? prologue)
566568
,@(let ((lnns (filter linenum? prologue)))
567569
(if (pair? lnns)
568570
(list (car lnns))

0 commit comments

Comments
 (0)