Ticket #114: pow-expr.patch
File pow-expr.patch, 2.8 KB (added by hopscc, 16 years ago) |
---|
-
Source/BackEndClr/SharpGenerator.cobra
4086 4086 on 'STAR_EQUALS' 4087 4087 op = '*=' 4088 4088 on 'STARSTAR_EQUALS' 4089 op = 'CobraLangInternal.CobraImp.PowerToEquals(' 4089 #op = 'CobraLangInternal.CobraImp.PowerToEquals(' 4090 op = 'System.Math.Pow(' 4090 4091 on 'SLASH_EQUALS' 4091 4092 op = '/=' # TODO: finish this 4092 4093 on 'SLASHSLASH_EQUALS' … … 4226 4227 on 'STAR' 4227 4228 op = '*' 4228 4229 on 'STARSTAR' 4229 op = 'CobraLangInternal.CobraImp.PowerTo(' 4230 #op = 'CobraLangInternal.CobraImp.PowerTo(' 4231 op = 'System.Math.Pow(' 4232 if _left.isKindOf(intType) and _right.isKindOf(intType) 4233 pre = '(' + .compiler.intType.sharpRef + ')' 4230 4234 on 'SLASH' 4231 4235 op = '/' 4232 4236 if _left.isKindOf(intType) and _right.isKindOf(intType) -
Source/BinaryOpExpr.cobra
452 452 453 453 cue init(opToken as IToken, op as String, left as Expr, right as Expr) 454 454 base.init(opToken, op, left, right) 455 assert op in ['PLUS', 'MINUS', 'STAR', 'S LASH', 'SLASHSLASH', 'PERCENT']455 assert op in ['PLUS', 'MINUS', 'STAR', 'STARSTAR', 'SLASH', 'SLASHSLASH', 'PERCENT'] 456 456 457 457 def _bindImp 458 458 base._bindImp -
Tests/100-basics/930-pow-expr.cobra
1 class Pwr 2 3 def main is shared 4 for i in [2,3,4,5] 5 #x = (10 ** i) to int 6 x = 10 ** i 7 #print x 8 assert x in [100, 1000, 10000, 100000] 9 10 y = 2 ** i 11 #print y 12 assert y in [4,8,16,32] 13 14 for j in [2f, 3f, 4f, 5f] 15 z = 3 ** j 16 #print z 17 assert z.getType is Double 18 assert z in [9f, 27f, 81f, 243f] 19 20 f = 1.1f ** 3f # 1.331 21 assert f >= 1.331f and f < 1.3311f -
Developer/IntermediateReleaseNotes.text
29 29 30 30 * Initializers must now start with a call to another initializer in the same class or a base initializer. In other words, calls to the base initializer are not invisibly inserted by the compiler. 31 31 32 * Minimal support for ** operator (power expressions): ticket 114 32 33 34 33 35 ================================================================================ 34 36 Library 35 37 ================================================================================