Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
96f0ba58
Commit
96f0ba58
authored
Apr 21, 2014
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add int ** float, and now the polymorphism test is closer to working
parent
d3e47359
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
src/runtime/int.cpp
src/runtime/int.cpp
+8
-3
test/tests/polymorphism_small.py
test/tests/polymorphism_small.py
+0
-2
No files found.
src/runtime/int.cpp
View file @
96f0ba58
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
// limitations under the License.
#include <cmath>
#include <sstream>
#include <sstream>
#include "core/common.h"
#include "core/common.h"
...
@@ -273,11 +274,15 @@ extern "C" Box* intMul(BoxedInt* lhs, Box *rhs) {
...
@@ -273,11 +274,15 @@ extern "C" Box* intMul(BoxedInt* lhs, Box *rhs) {
extern
"C"
Box
*
intPow
(
BoxedInt
*
lhs
,
Box
*
rhs
)
{
extern
"C"
Box
*
intPow
(
BoxedInt
*
lhs
,
Box
*
rhs
)
{
assert
(
lhs
->
cls
==
int_cls
);
assert
(
lhs
->
cls
==
int_cls
);
if
(
rhs
->
cls
!=
int_cls
)
{
if
(
rhs
->
cls
==
int_cls
)
{
return
NotImplemented
;
}
BoxedInt
*
rhs_int
=
static_cast
<
BoxedInt
*>
(
rhs
);
BoxedInt
*
rhs_int
=
static_cast
<
BoxedInt
*>
(
rhs
);
return
boxInt
(
pow_i64_i64
(
lhs
->
n
,
rhs_int
->
n
));
return
boxInt
(
pow_i64_i64
(
lhs
->
n
,
rhs_int
->
n
));
}
else
if
(
rhs
->
cls
==
float_cls
)
{
BoxedFloat
*
rhs_float
=
static_cast
<
BoxedFloat
*>
(
rhs
);
return
boxFloat
(
pow
(
lhs
->
n
,
rhs_float
->
d
));
}
else
{
return
NotImplemented
;
}
}
}
extern
"C"
Box
*
intRShift
(
BoxedInt
*
lhs
,
Box
*
rhs
)
{
extern
"C"
Box
*
intRShift
(
BoxedInt
*
lhs
,
Box
*
rhs
)
{
...
...
test/tests/polymorphism_small.py
View file @
96f0ba58
# expected: fail
class
Union
(
object
):
class
Union
(
object
):
def
__init__
(
self
,
subs
):
def
__init__
(
self
,
subs
):
self
.
subs
=
subs
self
.
subs
=
subs
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment