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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
b6df7f92
Commit
b6df7f92
authored
Feb 18, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix empty multi-dimensional array declarations.
parent
796db041
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+15
-3
No files found.
Cython/Compiler/Nodes.py
View file @
b6df7f92
...
...
@@ -661,6 +661,17 @@ class CArgDeclNode(Node):
base_type
=
self
.
base_type
.
analyse
(
env
,
could_be_name
=
could_be_name
)
if
hasattr
(
self
.
base_type
,
'arg_name'
)
and
self
.
base_type
.
arg_name
:
self
.
declarator
.
name
=
self
.
base_type
.
arg_name
# The parser is unable to resolve the ambiguity of [] as part of the
# type (e.g. in buffers) or empty declarator (as with arrays).
# This is only arises for empty multi-dimensional arrays.
if
(
base_type
.
is_array
and
isinstance
(
self
.
base_type
,
TemplatedTypeNode
)
and
isinstance
(
self
.
declarator
,
CArrayDeclaratorNode
)):
declarator
=
self
.
declarator
while
isinstance
(
declarator
.
base
,
CArrayDeclaratorNode
):
declarator
=
declarator
.
base
declarator
.
base
=
self
.
base_type
.
array_declarator
base_type
=
base_type
.
base_type
return
self
.
declarator
.
analyse
(
base_type
,
env
,
nonempty
=
nonempty
)
else
:
return
self
.
name_declarator
,
self
.
type
...
...
@@ -821,7 +832,7 @@ class TemplatedTypeNode(CBaseTypeNode):
else
:
# Array
empty_declarator
=
CNameDeclaratorNode
(
self
.
pos
,
name
=
""
)
empty_declarator
=
CNameDeclaratorNode
(
self
.
pos
,
name
=
""
,
cname
=
None
)
if
len
(
self
.
positional_args
)
>
1
or
self
.
keyword_args
.
key_value_pairs
:
error
(
self
.
pos
,
"invalid array declaration"
)
self
.
type
=
PyrexTypes
.
error_type
...
...
@@ -832,9 +843,10 @@ class TemplatedTypeNode(CBaseTypeNode):
dimension
=
None
else
:
dimension
=
self
.
positional_args
[
0
]
self
.
type
=
CArrayDeclaratorNode
(
self
.
pos
,
self
.
array_declarator
=
CArrayDeclaratorNode
(
self
.
pos
,
base
=
empty_declarator
,
dimension
=
dimension
).
analyse
(
base_type
,
env
)[
1
]
dimension
=
dimension
)
self
.
type
=
self
.
array_declarator
.
analyse
(
base_type
,
env
)[
1
]
return
self
.
type
...
...
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