|
109 | 109 |
|
110 | 110 | (define (toplevel-only-expr? e)
|
111 | 111 | (and (pair? e)
|
112 |
| - (or (memq (car e) '(toplevel line module import importall using export |
| 112 | + (or (memq (car e) '(toplevel line module import using export |
113 | 113 | error incomplete))
|
114 | 114 | (and (eq? (car e) 'global) (every symbol? (cdr e))
|
115 | 115 | (every (lambda (x) (not (memq x '(true false)))) (cdr e))))))
|
116 | 116 |
|
117 | 117 | (define (expand-toplevel-expr e)
|
118 | 118 | (cond ((or (atom? e) (toplevel-only-expr? e))
|
119 | 119 | (if (underscore-symbol? e)
|
120 |
| - (syntax-deprecation "underscores as an rvalue" "" #f)) |
| 120 | + (error "all-underscore identifier used as rvalue")) |
121 | 121 | e)
|
122 | 122 | (else
|
123 | 123 | (let ((last *in-expand*))
|
|
140 | 140 | (block
|
141 | 141 | ,loc
|
142 | 142 | (call (core eval) ,name ,x)))
|
143 |
| - (if (&& (call (top isdefined) (core Main) (quote Base)) |
144 |
| - (call (top isdefined) (|.| (core Main) (quote Base)) (quote @deprecate))) |
145 |
| - (call eval |
146 |
| - (quote |
147 |
| - (macrocall (|.| (|.| (core Main) (quote Base)) (quote @deprecate)) |
148 |
| - (line 0 none) |
149 |
| - (call eval m x) |
150 |
| - (call (|.| Core (quote eval)) m x) ; should be (core eval), but format as Core.eval(m, x) for deprecation warning |
151 |
| - false)))) |
152 | 143 | (= (call include ,x)
|
153 | 144 | (block
|
154 | 145 | ,loc
|
|
267 | 258 | ((length= lno 2) `(,(cadr lno) none))
|
268 | 259 | (else (cdr lno))))
|
269 | 260 |
|
| 261 | +(define (format-loc lno) |
| 262 | + (let* ((lf (extract-line-file lno)) (line (car lf)) (file (cadr lf))) |
| 263 | + (format-file-line file line #f))) |
| 264 | + |
| 265 | +(define (format-file-line file line exactloc) |
| 266 | + (if (or (= line 0) (eq? file 'none)) |
| 267 | + "" |
| 268 | + (string (if exactloc " at " " around ") file ":" line))) |
| 269 | + |
270 | 270 | (define (format-syntax-deprecation what instead file line exactloc)
|
271 | 271 | (string "Deprecated syntax `" what "`"
|
272 |
| - (if (or (= line 0) (eq? file 'none)) |
273 |
| - "" |
274 |
| - (string (if exactloc " at " " around ") file ":" line)) |
| 272 | + (format-file-line file line exactloc) |
275 | 273 | "."
|
276 | 274 | (if (equal? instead "") ""
|
277 |
| - (string #\newline "Use `" instead "` instead.")))) |
| 275 | + (string #\newline "Use `" instead "` instead.")))) |
278 | 276 |
|
279 | 277 | ; Corresponds to --depwarn 0="no", 1="yes", 2="error"
|
280 | 278 | (define *depwarn-opt* 1)
|
|
0 commit comments