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
e6429bcd
Commit
e6429bcd
authored
Jun 19, 2008
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pulled transforms from ModuleNode to Main
parent
868538b3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
13 deletions
+17
-13
Cython/Compiler/Main.py
Cython/Compiler/Main.py
+7
-1
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+6
-8
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+4
-4
No files found.
Cython/Compiler/Main.py
View file @
e6429bcd
...
@@ -343,16 +343,22 @@ def create_generate_code(context, options):
...
@@ -343,16 +343,22 @@ def create_generate_code(context, options):
def
generate_code
(
module_node
):
def
generate_code
(
module_node
):
scope
=
module_node
.
scope
scope
=
module_node
.
scope
result
=
create_default_resultobj
(
module_node
.
compilation_source
,
options
)
result
=
create_default_resultobj
(
module_node
.
compilation_source
,
options
)
module_node
.
process_implementation
(
scope
,
options
,
result
)
module_node
.
process_implementation
(
options
,
result
)
return
result
return
result
return
generate_code
return
generate_code
def
create_default_pipeline
(
context
,
options
):
def
create_default_pipeline
(
context
,
options
):
from
ParseTreeTransforms
import
WithTransform
,
PostParse
from
ParseTreeTransforms
import
WithTransform
,
PostParse
from
ParseTreeTransforms
import
AnalyseDeclarationsTransform
,
AnalyseExpressionsTransform
from
ModuleNode
import
check_c_classes
return
[
return
[
create_parse
(
context
),
create_parse
(
context
),
PostParse
(),
PostParse
(),
WithTransform
(),
WithTransform
(),
AnalyseDeclarationsTransform
(),
check_c_classes
,
AnalyseExpressionsTransform
(),
create_generate_code
(
context
,
options
)
create_generate_code
(
context
,
options
)
]
]
...
...
Cython/Compiler/ModuleNode.py
View file @
e6429bcd
...
@@ -25,6 +25,10 @@ from PyrexTypes import py_object_type
...
@@ -25,6 +25,10 @@ from PyrexTypes import py_object_type
from
Cython.Utils
import
open_new_file
,
replace_suffix
from
Cython.Utils
import
open_new_file
,
replace_suffix
def
check_c_classes
(
module_node
):
module_node
.
scope
.
check_c_classes
()
return
module_node
class
ModuleNode
(
Nodes
.
Node
,
Nodes
.
BlockNode
):
class
ModuleNode
(
Nodes
.
Node
,
Nodes
.
BlockNode
):
# doc string or None
# doc string or None
# body StatListNode
# body StatListNode
...
@@ -47,14 +51,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -47,14 +51,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
env
.
doc
=
self
.
doc
env
.
doc
=
self
.
doc
self
.
body
.
analyse_declarations
(
env
)
self
.
body
.
analyse_declarations
(
env
)
def
process_implementation
(
self
,
env
,
options
,
result
):
def
process_implementation
(
self
,
options
,
result
):
# Currently, scope is also set by the parse step in Main.py; they will be the same
env
=
self
.
scope
assert
self
.
scope
is
env
self
.
scope
=
env
from
ParseTreeTransforms
import
AnalyseDeclarationsTransform
,
AnalyseExpressionsTransform
AnalyseDeclarationsTransform
(
env
).
visit_ModuleNode
(
self
)
# self.analyse_declarations(env)
env
.
check_c_classes
()
AnalyseExpressionsTransform
().
visit_ModuleNode
(
self
)
# self.body.analyse_expressions(env)
env
.
return_type
=
PyrexTypes
.
c_void_type
env
.
return_type
=
PyrexTypes
.
c_void_type
self
.
referenced_modules
=
[]
self
.
referenced_modules
=
[]
self
.
find_referenced_modules
(
env
,
self
.
referenced_modules
,
{})
self
.
find_referenced_modules
(
env
,
self
.
referenced_modules
,
{})
...
...
Cython/Compiler/ParseTreeTransforms.py
View file @
e6429bcd
...
@@ -145,9 +145,9 @@ class WithTransform(VisitorTransform):
...
@@ -145,9 +145,9 @@ class WithTransform(VisitorTransform):
class
AnalyseDeclarationsTransform
(
VisitorTransform
):
class
AnalyseDeclarationsTransform
(
VisitorTransform
):
def
__
init__
(
self
,
env
):
def
__
call__
(
self
,
root
):
VisitorTransform
.
__init__
(
self
)
self
.
env_stack
=
[
root
.
scope
]
self
.
env_stack
=
[
env
]
return
super
(
AnalyseDeclarationsTransform
,
self
).
__call__
(
root
)
def
visit_ModuleNode
(
self
,
node
):
def
visit_ModuleNode
(
self
,
node
):
node
.
analyse_declarations
(
self
.
env_stack
[
-
1
])
node
.
analyse_declarations
(
self
.
env_stack
[
-
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