Ticket #114 (closed defect: fixed)
Missing implementation of power/PowerTo/PowerToEquals Binary Op
Reported by: | hopscc | Owned by: | Chuck |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Cobra Compiler | Version: | 0.8.0 |
Keywords: | Cc: |
Description
If write a program that uses the power binary op (STARSTAR '**')
as in
return Math.sqrt(Math.abs(x)) + (5.0f * x ** 3.0f)
get an assert error in BinaryOP.cobra
Unhandled Exception: Cobra.Lang.AssertException: sourceSite = C:\home\hops\src\cobra\wkspace\Source\BinaryOpExpr.cobra:455 in BinaryMathExpr.init for object BinaryMathExpr-sh(5373, didBindInh=false, didBindInt=false, didBindImp=false, token=Token(STARSTAR, '**', '**', ln 5, col 26, TPK.cobra), type=nil, 5373) info = nil this = BinaryMathExpr-de(5373, didBindInh=false, didBindInt=false, didBindImp=false, token=Token(STARSTAR, '**', '**', ln 5, col 26, TPK.cobra), type=nil, op=STARSTAR, left=IdentifierExpr-sh(5371, didBindInh=false, didBindInt=false, didBindImp=false, token=Token(ID, 'x', 'x', ln 5, col 24, TPK.cobra), name=x, type=nil, 5371), right=IntegerLit-sh(5372, didBindInh=false, didBindInt=false, didBindImp=false, token=Token(INTEGER_LIT, '3', 3, ln 5, col 29, TPK.cobra), type=nil, 5372), 5373) (op in ['PLUS', 'MINUS', 'STAR', 'SLASH', 'SLASHSLASH', 'PERCENT']) = false op = 'STARSTAR' ['PLUS', 'MINUS', 'STAR', 'SLASH', 'SLASHSLASH', 'PERCENT'] = List<of String>['PLUS', 'MINUS', 'STAR', 'SLASH', 'SLASHSLASH', 'PERCENT']
Due missing 'STARSTAR' entry in assert list on that line.
If correct that get c# error re missing method CobraImp.PowerTo
error: "Cobra.Lang.CobraImp" does not contain a definition for "PowerTo" (C#)
At the very least an unimplemented operator should be trapped and emit an error message admitting its unimplemented
otherwise implement the powerTo/powerToEquals methods in Native.cs
Attachments
Change History
Note: See
TracTickets for help on using
tickets.