Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
e50b6cc4
Commit
e50b6cc4
authored
Feb 21, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup
parent
b60ba931
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
24 deletions
+10
-24
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+6
-19
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+4
-3
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+0
-2
No files found.
Cython/Compiler/ExprNodes.py
View file @
e50b6cc4
...
@@ -1934,7 +1934,6 @@ class IndexNode(ExprNode):
...
@@ -1934,7 +1934,6 @@ class IndexNode(ExprNode):
self
.
index
.
type
)
self
.
index
.
type
)
elif
self
.
base
.
type
.
is_cpp_class
:
elif
self
.
base
.
type
.
is_cpp_class
:
function
=
env
.
lookup_operator
(
"[]"
,
[
self
.
base
,
self
.
index
])
function
=
env
.
lookup_operator
(
"[]"
,
[
self
.
base
,
self
.
index
])
function
=
self
.
base
.
type
.
scope
.
lookup
(
"operator[]"
)
if
function
is
None
:
if
function
is
None
:
error
(
self
.
pos
,
"Indexing '%s' not supported for index type '%s'"
%
(
self
.
base
.
type
,
self
.
index
.
type
))
error
(
self
.
pos
,
"Indexing '%s' not supported for index type '%s'"
%
(
self
.
base
.
type
,
self
.
index
.
type
))
self
.
type
=
PyrexTypes
.
error_type
self
.
type
=
PyrexTypes
.
error_type
...
@@ -1946,7 +1945,7 @@ class IndexNode(ExprNode):
...
@@ -1946,7 +1945,7 @@ class IndexNode(ExprNode):
self
.
index
=
self
.
index
.
coerce_to
(
func_type
.
args
[
0
].
type
,
env
)
self
.
index
=
self
.
index
.
coerce_to
(
func_type
.
args
[
0
].
type
,
env
)
self
.
type
=
func_type
.
return_type
self
.
type
=
func_type
.
return_type
if
setting
and
not
func_type
.
return_type
.
is_reference
:
if
setting
and
not
func_type
.
return_type
.
is_reference
:
error
(
self
.
pos
,
"Can't set non-reference '%s'"
%
self
.
type
)
error
(
self
.
pos
,
"Can't set non-reference
result
'%s'"
%
self
.
type
)
else
:
else
:
error
(
self
.
pos
,
error
(
self
.
pos
,
"Attempting to index non-array type '%s'"
%
"Attempting to index non-array type '%s'"
%
...
@@ -4201,7 +4200,7 @@ class UnopNode(ExprNode):
...
@@ -4201,7 +4200,7 @@ class UnopNode(ExprNode):
def
is_cpp_operation
(
self
):
def
is_cpp_operation
(
self
):
type
=
self
.
operand
.
type
type
=
self
.
operand
.
type
return
type
.
is_cpp_class
or
type
.
is_reference
and
type
.
base_type
.
is_cpp_class
return
type
.
is_cpp_class
def
coerce_operand_to_pyobject
(
self
,
env
):
def
coerce_operand_to_pyobject
(
self
,
env
):
self
.
operand
=
self
.
operand
.
coerce_to_pyobject
(
env
)
self
.
operand
=
self
.
operand
.
coerce_to_pyobject
(
env
)
...
@@ -4228,7 +4227,7 @@ class UnopNode(ExprNode):
...
@@ -4228,7 +4227,7 @@ class UnopNode(ExprNode):
def
analyse_cpp_operation
(
self
,
env
):
def
analyse_cpp_operation
(
self
,
env
):
type
=
self
.
operand
.
type
type
=
self
.
operand
.
type
if
type
.
is_ptr
or
type
.
is_reference
:
if
type
.
is_ptr
:
type
=
type
.
base_type
type
=
type
.
base_type
function
=
type
.
scope
.
lookup
(
"operator%s"
%
self
.
operator
)
function
=
type
.
scope
.
lookup
(
"operator%s"
%
self
.
operator
)
if
not
function
:
if
not
function
:
...
@@ -4745,14 +4744,8 @@ class BinopNode(ExprNode):
...
@@ -4745,14 +4744,8 @@ class BinopNode(ExprNode):
return
type1
.
is_pyobject
or
type2
.
is_pyobject
return
type1
.
is_pyobject
or
type2
.
is_pyobject
def
is_cpp_operation
(
self
):
def
is_cpp_operation
(
self
):
type1
=
self
.
operand1
.
type
return
(
self
.
operand1
.
type
.
is_cpp_class
type2
=
self
.
operand2
.
type
or
self
.
operand2
.
type
.
is_cpp_class
)
if
type1
.
is_reference
:
type1
=
type1
.
base_type
if
type2
.
is_reference
:
type2
=
type2
.
base_type
return
(
type1
.
is_cpp_class
or
type2
.
is_cpp_class
)
def
analyse_cpp_operation
(
self
,
env
):
def
analyse_cpp_operation
(
self
,
env
):
type1
=
self
.
operand1
.
type
type1
=
self
.
operand1
.
type
...
@@ -5401,13 +5394,7 @@ class CmpNode(object):
...
@@ -5401,13 +5394,7 @@ class CmpNode(object):
return
result
return
result
def
is_cpp_comparison
(
self
):
def
is_cpp_comparison
(
self
):
type1
=
self
.
operand1
.
type
return
self
.
operand1
.
type
.
is_cpp_class
or
self
.
operand2
.
type
.
is_cpp_class
type2
=
self
.
operand2
.
type
if
type1
.
is_reference
:
type1
=
type1
.
base_type
if
type2
.
is_reference
:
type2
=
type2
.
base_type
return
type1
.
is_cpp_class
or
type2
.
is_cpp_class
def
find_common_int_type
(
self
,
env
,
op
,
operand1
,
operand2
):
def
find_common_int_type
(
self
,
env
,
op
,
operand1
,
operand2
):
# type1 != type2 and at least one of the types is not a C int
# type1 != type2 and at least one of the types is not a C int
...
...
Cython/Compiler/PyrexTypes.py
View file @
e50b6cc4
...
@@ -1368,6 +1368,9 @@ class CReferenceType(BaseType):
...
@@ -1368,6 +1368,9 @@ class CReferenceType(BaseType):
def
__repr__
(
self
):
def
__repr__
(
self
):
return
"<CReferenceType %s>"
%
repr
(
self
.
ref_base_type
)
return
"<CReferenceType %s>"
%
repr
(
self
.
ref_base_type
)
def
__str__
(
self
):
return
"%s &"
%
self
.
ref_base_type
def
as_argument_type
(
self
):
def
as_argument_type
(
self
):
return
self
return
self
...
@@ -2303,9 +2306,7 @@ def best_match(args, functions, pos=None):
...
@@ -2303,9 +2306,7 @@ def best_match(args, functions, pos=None):
src_type
=
args
[
i
].
type
src_type
=
args
[
i
].
type
dst_type
=
func_type
.
args
[
i
].
type
dst_type
=
func_type
.
args
[
i
].
type
if
dst_type
.
assignable_from
(
src_type
):
if
dst_type
.
assignable_from
(
src_type
):
if
src_type
==
dst_type
or
(
dst_type
.
is_reference
and
\
if
src_type
==
dst_type
or
dst_type
.
same_as
(
src_type
):
src_type
==
dst_type
.
base_type
)
\
or
dst_type
.
same_as
(
src_type
):
pass
# score 0
pass
# score 0
elif
is_promotion
(
src_type
,
dst_type
):
elif
is_promotion
(
src_type
,
dst_type
):
score
[
2
]
+=
1
score
[
2
]
+=
1
...
...
Cython/Compiler/Symtab.py
View file @
e50b6cc4
...
@@ -604,8 +604,6 @@ class Scope(object):
...
@@ -604,8 +604,6 @@ class Scope(object):
def lookup_operator(self, operator, operands):
def lookup_operator(self, operator, operands):
if operands[0].type.is_cpp_class:
if operands[0].type.is_cpp_class:
obj_type = operands[0].type
obj_type = operands[0].type
if obj_type.is_reference:
obj_type = obj_type.base_type
method = obj_type.scope.lookup("
operator
%
s
" % operator)
method = obj_type.scope.lookup("
operator
%
s
" % operator)
if method is not None:
if method is not None:
res = PyrexTypes.best_match(operands[1:], method.all_alternatives())
res = PyrexTypes.best_match(operands[1:], method.all_alternatives())
...
...
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