Skip to content

Commit

Permalink
add location info to inner constructor deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Feb 8, 2017
1 parent 42c0cc0 commit 02f020e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,15 @@
(sig (car temp))
(params (cdr temp)))
(if (pair? params)
(syntax-deprecation #f (string "inner constructor " name "(...)")
(deparse `(where (call (curly ,name ,@params) ...) ,@params))))
(let* ((lnos (filter (lambda (e) (and (pair? e) (eq? (car e) 'line)))
body))
(lno (if (null? lnos) '() (car lnos))))
(syntax-deprecation #f
(string "inner constructor " name "(...)"
(cond ((length= lno 2) (string " around line " (cadr lno)))
((length= lno 3) (string " around " (caddr lno) ":" (cadr lno)))
(else "")))
(deparse `(where (call (curly ,name ,@params) ...) ,@params)))))
`(,keyword ,sig ,(ctor-body body params)))))))

;; rewrite calls to `new( ... )` to `new` expressions on the appropriate
Expand Down

0 comments on commit 02f020e

Please sign in to comment.