[svn:parrot] r42903 - trunk/compilers/pct/src/PAST
pmichaud at svn.parrot.org
pmichaud at svn.parrot.org
Sun Dec 6 00:34:07 UTC 2009
Author: pmichaud
Date: Sun Dec 6 00:34:06 2009
New Revision: 42903
URL: https://trac.parrot.org/parrot/changeset/42903
Log:
[pct]: Allow PAST::Val int constants to auto-promote to num constants
by adding ".0" to the stringified version.
Modified:
trunk/compilers/pct/src/PAST/Compiler.pir
Modified: trunk/compilers/pct/src/PAST/Compiler.pir
==============================================================================
--- trunk/compilers/pct/src/PAST/Compiler.pir Sat Dec 5 22:48:31 2009 (r42902)
+++ trunk/compilers/pct/src/PAST/Compiler.pir Sun Dec 6 00:34:06 2009 (r42903)
@@ -2451,7 +2451,16 @@
.local string rtype
rtype = options['rtype']
$I0 = index valflags, rtype
+ if $I0 < 0 goto result_convert
+ ops.'result'(value)
+ .return (ops)
+
+ result_convert:
+ # handle int-to-num conversion here
+ if rtype != 'n' goto result_pmc
+ $I0 = index valflags, 'i'
if $I0 < 0 goto result_pmc
+ value = concat value, '.0'
ops.'result'(value)
.return (ops)
More information about the parrot-commits
mailing list