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
befacc74
Commit
befacc74
authored
Feb 20, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #314 from undingen/fix_is
Fix compvar '1 is 1.0' and '1.0 is 1' handling
parents
39ae0679
0d8141e3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
src/codegen/compvars.cpp
src/codegen/compvars.cpp
+6
-0
test/tests/is.py
test/tests/is.py
+7
-0
No files found.
src/codegen/compvars.cpp
View file @
befacc74
...
...
@@ -888,6 +888,9 @@ public:
if
(
!
can_lower
)
{
// if the rhs is a float convert the lhs to a float and do the operation on it.
if
(
rhs
->
getType
()
==
FLOAT
)
{
if
(
op_type
==
AST_TYPE
::
IsNot
||
op_type
==
AST_TYPE
::
Is
)
return
makeBool
(
op_type
==
AST_TYPE
::
IsNot
);
ConcreteCompilerVariable
*
converted_left
=
var
->
makeConverted
(
emitter
,
INT
);
llvm
::
Value
*
conv
=
emitter
.
getBuilder
()
->
CreateSIToFP
(
converted_left
->
getValue
(),
g
.
double_
);
converted_left
->
decvref
(
emitter
);
...
...
@@ -1115,6 +1118,9 @@ public:
if
(
rhs
->
getType
()
==
FLOAT
)
{
converted_right
=
rhs
->
makeConverted
(
emitter
,
FLOAT
);
}
else
{
if
(
op_type
==
AST_TYPE
::
IsNot
||
op_type
==
AST_TYPE
::
Is
)
return
makeBool
(
op_type
==
AST_TYPE
::
IsNot
);
converted_right
=
rhs
->
makeConverted
(
emitter
,
INT
);
llvm
::
Value
*
conv
=
emitter
.
getBuilder
()
->
CreateSIToFP
(
converted_right
->
getValue
(),
g
.
double_
);
converted_right
->
decvref
(
emitter
);
...
...
test/tests/is.py
View file @
befacc74
...
...
@@ -7,3 +7,10 @@ print c is C
print
range
is
True
print
c
is
None
print
1
is
1.0
print
1.0
is
1
print
1
is
True
print
0
is
False
print
True
is
1
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