Ticket #155 (closed defect)

Opened 15 years ago

Last modified 15 years ago

Incorrect rendering of case clauses

Reported by: untyped Owned by: dherman
Priority: major Milestone:
Component: dherman/javascript.plt Keywords: javascript,print,switch,case clause
Cc: Version: (9 0)
Racket Version: 4.1.4

Description

Hi Dave,

JS.plt misses the "default:" and "case x:" bits when it's rendering case clauses. Here's a revised version of the format-case-clause method in print.ss:

;; format-case-clause : CaseClause -> any
(define (format-case-clause case)
  (let ([question (CaseClause-question case)]
        [answer (CaseClause-answer case)])
    (h-append
     (if question
         (h-append (text "case ") (format-expression question))
         (text "default"))
     (text ":")
     (if (= (length answer) 1)
         (format-nested-substatement (car answer))
         (nest (current-indentation-width)
               (h-append line
                         (format-map format-substatement answer formatters/StatementList)))))))

Cheers,

-- Dave

Change History

Changed 15 years ago by dherman

  • status changed from new to closed

Fixed in 9:1. Thanks, Dave.

Note: See TracTickets for help on using tickets.