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
Hide 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):
...
@@ -349,13 +349,14 @@ def create_generate_code(context, options):
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
ParseTreeTransforms
import
AnalyseDeclarationsTransform
,
AnalyseExpressionsTransform
,
MarkClosureVisitor
from
ModuleNode
import
check_c_classes
from
ModuleNode
import
check_c_classes
return
[
return
[
create_parse
(
context
),
create_parse
(
context
),
PostParse
(),
PostParse
(),
WithTransform
(),
WithTransform
(),
MarkClosureVisitor
(),
AnalyseDeclarationsTransform
(),
AnalyseDeclarationsTransform
(),
check_c_classes
,
check_c_classes
,
AnalyseExpressionsTransform
(),
AnalyseExpressionsTransform
(),
...
...
Cython/Compiler/Naming.py
View file @
4510e2ef
...
@@ -72,6 +72,7 @@ optional_args_cname = pyrex_prefix + "optional_args"
...
@@ -72,6 +72,7 @@ optional_args_cname = pyrex_prefix + "optional_args"
no_opt_args
=
pyrex_prefix
+
"no_opt_args"
no_opt_args
=
pyrex_prefix
+
"no_opt_args"
import_star
=
pyrex_prefix
+
"import_star"
import_star
=
pyrex_prefix
+
"import_star"
import_star_set
=
pyrex_prefix
+
"import_star_set"
import_star_set
=
pyrex_prefix
+
"import_star_set"
scope_obj_cname
=
pyrex_prefix
+
"scope"
line_c_macro
=
"__LINE__"
line_c_macro
=
"__LINE__"
...
...
Cython/Compiler/Nodes.py
View file @
4510e2ef
...
@@ -10,7 +10,7 @@ import Naming
...
@@ -10,7 +10,7 @@ import Naming
import
PyrexTypes
import
PyrexTypes
import
TypeSlots
import
TypeSlots
from
PyrexTypes
import
py_object_type
,
error_type
,
CTypedefType
,
CFuncType
from
PyrexTypes
import
py_object_type
,
error_type
,
CTypedefType
,
CFuncType
from
Symtab
import
ModuleScope
,
LocalScope
,
\
from
Symtab
import
ModuleScope
,
LocalScope
,
PersistentLocalScope
,
\
StructOrUnionScope
,
PyClassScope
,
CClassScope
StructOrUnionScope
,
PyClassScope
,
CClassScope
from
Cython.Utils
import
open_new_file
,
replace_suffix
,
EncodedString
from
Cython.Utils
import
open_new_file
,
replace_suffix
,
EncodedString
import
Options
import
Options
...
@@ -773,9 +773,11 @@ class FuncDefNode(StatNode, BlockNode):
...
@@ -773,9 +773,11 @@ class FuncDefNode(StatNode, BlockNode):
# return_type PyrexType
# return_type PyrexType
# #filename string C name of filename string const
# #filename string C name of filename string const
# entry Symtab.Entry
# entry Symtab.Entry
# needs_closure boolean Whether or not this function has inner functions/classes/yield
py_func
=
None
py_func
=
None
assmt
=
None
assmt
=
None
needs_closure
=
False
def
analyse_default_values
(
self
,
env
):
def
analyse_default_values
(
self
,
env
):
genv
=
env
.
global_scope
()
genv
=
env
.
global_scope
()
...
@@ -807,7 +809,10 @@ class FuncDefNode(StatNode, BlockNode):
...
@@ -807,7 +809,10 @@ class FuncDefNode(StatNode, BlockNode):
genv
=
env
genv
=
env
while
env
.
is_py_class_scope
or
env
.
is_c_class_scope
:
while
env
.
is_py_class_scope
or
env
.
is_c_class_scope
:
env
=
env
.
outer_scope
env
=
env
.
outer_scope
lenv
=
LocalScope
(
name
=
self
.
entry
.
name
,
outer_scope
=
genv
)
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
lenv
.
return_type
=
self
.
return_type
type
=
self
.
entry
.
type
type
=
self
.
entry
.
type
if
type
.
is_cfunction
:
if
type
.
is_cfunction
:
...
...
Cython/Compiler/ParseTreeTransforms.py
View file @
4510e2ef
...
@@ -185,7 +185,7 @@ class AnalyseExpressionsTransform(VisitorTransform):
...
@@ -185,7 +185,7 @@ class AnalyseExpressionsTransform(VisitorTransform):
self
.
visitchildren
(
node
)
self
.
visitchildren
(
node
)
return
node
return
node
class
MarkClosure
Node
(
VisitorTransform
):
class
MarkClosure
Visitor
(
VisitorTransform
):
needs_closure
=
False
needs_closure
=
False
...
...
Cython/Compiler/Symtab.py
View file @
4510e2ef
#
#
#
Pyrex -
Symbol Table
# Symbol Table
#
#
import
re
import
re
...
@@ -1121,6 +1121,11 @@ class LocalScope(Scope):
...
@@ -1121,6 +1121,11 @@ class LocalScope(Scope):
self.entries[name] = entry
self.entries[name] = entry
class PersistentLocalScope(LocalScope):
def mangle(self, prefix, name):
return "%s->%s" % (scope_obj_cname, name)
class StructOrUnionScope(Scope):
class StructOrUnionScope(Scope):
# Namespace of a C struct or union.
# 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