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
4510e2ef
Commit
4510e2ef
authored
Jun 19, 2008
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First pass at PersistentLocalScope
parent
ec7cd84b
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
5 deletions
+17
-5
Cython/Compiler/Main.py
Cython/Compiler/Main.py
+2
-1
Cython/Compiler/Naming.py
Cython/Compiler/Naming.py
+1
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+7
-2
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+1
-1
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+6
-1
No files found.
Cython/Compiler/Main.py
View file @
4510e2ef
...
...
@@ -349,13 +349,14 @@ def create_generate_code(context, options):
def
create_default_pipeline
(
context
,
options
):
from
ParseTreeTransforms
import
WithTransform
,
PostParse
from
ParseTreeTransforms
import
AnalyseDeclarationsTransform
,
AnalyseExpressionsTransform
from
ParseTreeTransforms
import
AnalyseDeclarationsTransform
,
AnalyseExpressionsTransform
,
MarkClosureVisitor
from
ModuleNode
import
check_c_classes
return
[
create_parse
(
context
),
PostParse
(),
WithTransform
(),
MarkClosureVisitor
(),
AnalyseDeclarationsTransform
(),
check_c_classes
,
AnalyseExpressionsTransform
(),
...
...
Cython/Compiler/Naming.py
View file @
4510e2ef
...
...
@@ -72,6 +72,7 @@ optional_args_cname = pyrex_prefix + "optional_args"
no_opt_args
=
pyrex_prefix
+
"no_opt_args"
import_star
=
pyrex_prefix
+
"import_star"
import_star_set
=
pyrex_prefix
+
"import_star_set"
scope_obj_cname
=
pyrex_prefix
+
"scope"
line_c_macro
=
"__LINE__"
...
...
Cython/Compiler/Nodes.py
View file @
4510e2ef
...
...
@@ -10,7 +10,7 @@ import Naming
import
PyrexTypes
import
TypeSlots
from
PyrexTypes
import
py_object_type
,
error_type
,
CTypedefType
,
CFuncType
from
Symtab
import
ModuleScope
,
LocalScope
,
\
from
Symtab
import
ModuleScope
,
LocalScope
,
PersistentLocalScope
,
\
StructOrUnionScope
,
PyClassScope
,
CClassScope
from
Cython.Utils
import
open_new_file
,
replace_suffix
,
EncodedString
import
Options
...
...
@@ -773,9 +773,11 @@ class FuncDefNode(StatNode, BlockNode):
# return_type PyrexType
# #filename string C name of filename string const
# entry Symtab.Entry
# needs_closure boolean Whether or not this function has inner functions/classes/yield
py_func
=
None
assmt
=
None
needs_closure
=
False
def
analyse_default_values
(
self
,
env
):
genv
=
env
.
global_scope
()
...
...
@@ -807,6 +809,9 @@ class FuncDefNode(StatNode, BlockNode):
genv
=
env
while
env
.
is_py_class_scope
or
env
.
is_c_class_scope
:
env
=
env
.
outer_scope
if
self
.
needs_closure
:
lenv
=
PersistentLocalScope
(
name
=
self
.
entry
.
name
,
outer_scope
=
genv
)
else
:
lenv
=
LocalScope
(
name
=
self
.
entry
.
name
,
outer_scope
=
genv
)
lenv
.
return_type
=
self
.
return_type
type
=
self
.
entry
.
type
...
...
Cython/Compiler/ParseTreeTransforms.py
View file @
4510e2ef
...
...
@@ -185,7 +185,7 @@ class AnalyseExpressionsTransform(VisitorTransform):
self
.
visitchildren
(
node
)
return
node
class
MarkClosure
Node
(
VisitorTransform
):
class
MarkClosure
Visitor
(
VisitorTransform
):
needs_closure
=
False
...
...
Cython/Compiler/Symtab.py
View file @
4510e2ef
#
#
Pyrex -
Symbol Table
# Symbol Table
#
import
re
...
...
@@ -1121,6 +1121,11 @@ class LocalScope(Scope):
self.entries[name] = entry
class PersistentLocalScope(LocalScope):
def mangle(self, prefix, name):
return "%s->%s" % (scope_obj_cname, name)
class StructOrUnionScope(Scope):
# Namespace of a C struct or union.
...
...
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