diff options
-rw-r--r-- | module/language/tree-il/analyze.scm | 8 | ||||
-rw-r--r-- | test-suite/tests/tree-il.test | 26 |
2 files changed, 33 insertions, 1 deletions
diff --git a/module/language/tree-il/analyze.scm b/module/language/tree-il/analyze.scm index 777507c76..9bcc92fdc 100644 --- a/module/language/tree-il/analyze.scm +++ b/module/language/tree-il/analyze.scm @@ -1,6 +1,6 @@ ;;; TREE-IL -> GLIL compiler -;; Copyright (C) 2001, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +;; Copyright (C) 2001, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. ;;;; This library is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU Lesser General Public @@ -1328,6 +1328,12 @@ accurate information is missing from a given `tree-il' element." ;; We don't have enough info to determine the exact number ;; of args, but we could determine a lower bound (TODO). (values 'any 'any)) + ((#\h #\H) + (let ((argc (if (memq #\: params) 2 1))) + (loop (cdr chars) 'literal '() + conditions end-group + (+ argc min-count) + (+ argc max-count)))) (else (loop (cdr chars) 'literal '() conditions end-group (+ 1 min-count) (+ 1 max-count))))) diff --git a/test-suite/tests/tree-il.test b/test-suite/tests/tree-il.test index 37cd386fe..8e294a748 100644 --- a/test-suite/tests/tree-il.test +++ b/test-suite/tests/tree-il.test @@ -2243,6 +2243,32 @@ (number? (string-contains (car w) "expected 1, got 2"))))) + (pass-if "~h" + (null? (call-with-warnings + (lambda () + (compile '((@ (ice-9 format) format) #t + "foo ~h ~a~%" 123.4 'bar) + #:opts %opts-w-format + #:to 'assembly))))) + + (pass-if "~:h with locale object" + (null? (call-with-warnings + (lambda () + (compile '((@ (ice-9 format) format) #t + "foo ~:h~%" 123.4 %global-locale) + #:opts %opts-w-format + #:to 'assembly))))) + + (pass-if "~:h without locale object" + (let ((w (call-with-warnings + (lambda () + (compile '((@ (ice-9 format) format) #t "foo ~,2:h" 123.4) + #:opts %opts-w-format + #:to 'assembly))))) + (and (= (length w) 1) + (number? (string-contains (car w) + "expected 2, got 1"))))) + (with-test-prefix "conditionals" (pass-if "literals" (null? (call-with-warnings |