From: <sc...@op...> - 2011-04-24 12:51:24
|
changeset: 19a8f698b482 in /home/euweb/scm/hg_repos/euphoria author: Matt Lewis url: http://scm.openeuphoria.org/hg/euphoria?cmd=changeset;node=19a8f698b482 description: * Fix translator type checking. INTEGER_CHECK ops coerce doubles to ints, which is the correct behavior. This was a regression when the code was refactored. * fixes ticket 655 diffstat: source/parser.e | 27 +++++++++++++++++---------- 1 files changed, 17 insertions(+), 10 deletions(-) diffs (37 lines): diff -r 353cbdd16f52 -r 19a8f698b482 source/parser.e --- a/source/parser.e Sat Apr 23 19:15:45 2011 -0400 +++ b/source/parser.e Sun Apr 24 08:20:44 2011 -0400 @@ -1467,16 +1467,23 @@ if TRANSLATE then if OpTypeCheck then - if which_type != object_type then - if SymTab[which_type][S_EFFECT] then - -- only call user-defined types that have side-effects - emit_opnd(var) - op_info1 = which_type - --emit_op(PROC) - emit_or_inline() - emit_op(TYPE_CHECK) - end if - end if + switch which_type do + case object_type, sequence_type, atom_type then + -- do nothing + case integer_type then + -- need to do this to coerce atoms to integers + op_info1 = var + emit_op(INTEGER_CHECK) + case else + if SymTab[which_type][S_EFFECT] then + -- only call user-defined types that have side-effects + emit_opnd(var) + op_info1 = which_type + --emit_op(PROC) + emit_or_inline() + emit_op(TYPE_CHECK) + end if + end switch end if else |