Skip to content

Commit

Permalink
[enhance] compiler: opaToQml check integer boundaries
Browse files Browse the repository at this point in the history
  • Loading branch information
BourgerieQuentin committed Aug 8, 2012
1 parent 2a0cbfd commit 20b038e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions compiler/opalang/opaToQml.ml
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,15 @@ struct
let const_expr (const_node, opa_annot) =
match const_node with
| SA.CInt i ->
(try QA.Int (Big_int.int_of_big_int i)
with Failure "int_of_big_int" ->
(if QmlAstUtils.Const.check_int i then
QA.Int i
else
let context = OpaError.Context.annot opa_annot in
OpaError.error context
"Too big integer literal : %s@\nThe biggest int handled : %d"
"Integer literal {@<bright>%s@} is out of range [%s, %s]"
(Big_int.string_of_big_int i)
Pervasives.max_int)
(Big_int.string_of_big_int (QmlAstUtils.Const.min_int ()))
(Big_int.string_of_big_int (QmlAstUtils.Const.max_int ())))
| SA.CFloat f -> QA.Float f
| SA.CString s -> QA.String s

Expand Down

0 comments on commit 20b038e

Please sign in to comment.