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
5ecb4ba9
Commit
5ecb4ba9
authored
Jan 16, 2019
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor code cleanups.
parent
51ac02b7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
11 deletions
+8
-11
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+8
-11
No files found.
Cython/Compiler/Symtab.py
View file @
5ecb4ba9
...
@@ -771,7 +771,8 @@ class Scope(object):
...
@@ -771,7 +771,8 @@ class Scope(object):
entry
.
cname
=
cname
entry
.
cname
=
cname
entry
.
func_cname
=
cname
entry
.
func_cname
=
cname
if
visibility
!=
'private'
and
visibility
!=
entry
.
visibility
:
if
visibility
!=
'private'
and
visibility
!=
entry
.
visibility
:
warning
(
pos
,
"Function '%s' previously declared as '%s', now as '%s'"
%
(
name
,
entry
.
visibility
,
visibility
),
1
)
warning
(
pos
,
"Function '%s' previously declared as '%s', now as '%s'"
%
(
name
,
entry
.
visibility
,
visibility
),
1
)
if
overridable
!=
entry
.
is_overridable
:
if
overridable
!=
entry
.
is_overridable
:
warning
(
pos
,
"Function '%s' previously declared as '%s'"
%
(
warning
(
pos
,
"Function '%s' previously declared as '%s'"
%
(
name
,
'cpdef'
if
overridable
else
'cdef'
),
1
)
name
,
'cpdef'
if
overridable
else
'cdef'
),
1
)
...
@@ -1029,8 +1030,7 @@ class BuiltinScope(Scope):
...
@@ -1029,8 +1030,7 @@ class BuiltinScope(Scope):
# If python_equiv == "*", the Python equivalent has the same name
# If python_equiv == "*", the Python equivalent has the same name
# as the entry, otherwise it has the name specified by python_equiv.
# as the entry, otherwise it has the name specified by python_equiv.
name
=
EncodedString
(
name
)
name
=
EncodedString
(
name
)
entry
=
self
.
declare_cfunction
(
name
,
type
,
None
,
cname
,
visibility
=
'extern'
,
entry
=
self
.
declare_cfunction
(
name
,
type
,
None
,
cname
,
visibility
=
'extern'
,
utility_code
=
utility_code
)
utility_code
=
utility_code
)
if
python_equiv
:
if
python_equiv
:
if
python_equiv
==
"*"
:
if
python_equiv
==
"*"
:
python_equiv
=
name
python_equiv
=
name
...
@@ -1438,8 +1438,7 @@ class ModuleScope(Scope):
...
@@ -1438,8 +1438,7 @@ class ModuleScope(Scope):
def
declare_cfunction
(
self
,
name
,
type
,
pos
,
def
declare_cfunction
(
self
,
name
,
type
,
pos
,
cname
=
None
,
visibility
=
'private'
,
api
=
0
,
in_pxd
=
0
,
cname
=
None
,
visibility
=
'private'
,
api
=
0
,
in_pxd
=
0
,
defining
=
0
,
modifiers
=
(),
utility_code
=
None
,
defining
=
0
,
modifiers
=
(),
utility_code
=
None
,
overridable
=
False
):
overridable
=
False
):
if
not
defining
and
'inline'
in
modifiers
:
if
not
defining
and
'inline'
in
modifiers
:
# TODO(github/1736): Make this an error.
# TODO(github/1736): Make this an error.
warning
(
pos
,
"Declarations should not be declared inline."
,
1
)
warning
(
pos
,
"Declarations should not be declared inline."
,
1
)
...
@@ -1937,8 +1936,7 @@ class StructOrUnionScope(Scope):
...
@@ -1937,8 +1936,7 @@ class StructOrUnionScope(Scope):
def
declare_cfunction
(
self
,
name
,
type
,
pos
,
def
declare_cfunction
(
self
,
name
,
type
,
pos
,
cname
=
None
,
visibility
=
'private'
,
api
=
0
,
in_pxd
=
0
,
cname
=
None
,
visibility
=
'private'
,
api
=
0
,
in_pxd
=
0
,
defining
=
0
,
modifiers
=
(),
defining
=
0
,
modifiers
=
(),
overridable
=
False
):
# currently no utility code ...
overridable
=
False
):
# currently no utility code ...
if
overridable
:
if
overridable
:
error
(
pos
,
"C struct/union member cannot be declared 'cpdef'"
)
error
(
pos
,
"C struct/union member cannot be declared 'cpdef'"
)
return
self
.
declare_var
(
name
,
type
,
pos
,
return
self
.
declare_var
(
name
,
type
,
pos
,
...
@@ -2219,8 +2217,7 @@ class CClassScope(ClassScope):
...
@@ -2219,8 +2217,7 @@ class CClassScope(ClassScope):
def
declare_cfunction
(
self
,
name
,
type
,
pos
,
def
declare_cfunction
(
self
,
name
,
type
,
pos
,
cname
=
None
,
visibility
=
'private'
,
api
=
0
,
in_pxd
=
0
,
cname
=
None
,
visibility
=
'private'
,
api
=
0
,
in_pxd
=
0
,
defining
=
0
,
modifiers
=
(),
utility_code
=
None
,
defining
=
0
,
modifiers
=
(),
utility_code
=
None
,
overridable
=
False
):
overridable
=
False
):
if
get_special_method_signature
(
name
)
and
not
self
.
parent_type
.
is_builtin_type
:
if
get_special_method_signature
(
name
)
and
not
self
.
parent_type
.
is_builtin_type
:
error
(
pos
,
"Special methods must be declared with 'def', not 'cdef'"
)
error
(
pos
,
"Special methods must be declared with 'def', not 'cdef'"
)
args
=
type
.
args
args
=
type
.
args
...
@@ -2296,8 +2293,8 @@ class CClassScope(ClassScope):
...
@@ -2296,8 +2293,8 @@ class CClassScope(ClassScope):
# overridden methods of builtin types still have their Python
# overridden methods of builtin types still have their Python
# equivalent that must be accessible to support bound methods
# equivalent that must be accessible to support bound methods
name
=
EncodedString
(
name
)
name
=
EncodedString
(
name
)
entry
=
self
.
declare_cfunction
(
name
,
type
,
None
,
cname
,
visibility
=
'extern'
,
entry
=
self
.
declare_cfunction
(
utility_code
=
utility_code
)
name
,
type
,
pos
=
None
,
cname
=
cname
,
visibility
=
'extern'
,
utility_code
=
utility_code
)
var_entry
=
Entry
(
name
,
name
,
py_object_type
)
var_entry
=
Entry
(
name
,
name
,
py_object_type
)
var_entry
.
is_variable
=
1
var_entry
.
is_variable
=
1
var_entry
.
is_builtin
=
1
var_entry
.
is_builtin
=
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