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
fa9cca20
Commit
fa9cca20
authored
Oct 03, 2009
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move nodes to exprnodes
parent
833e3b2c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
35 deletions
+39
-35
Cython/Compiler/AnalysedTreeTransforms.py
Cython/Compiler/AnalysedTreeTransforms.py
+1
-35
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+38
-0
No files found.
Cython/Compiler/AnalysedTreeTransforms.py
View file @
fa9cca20
from
Cython.Compiler.Visitor
import
VisitorTransform
,
ScopeTrackingTransform
,
TreeVisitor
from
Nodes
import
StatListNode
,
SingleAssignmentNode
from
ExprNodes
import
(
DictNode
,
DictItemNode
,
NameNode
,
UnicodeNode
,
NoneNode
,
ExprNode
,
AttributeNode
)
ExprNode
,
AttributeNode
,
ModuleRefNode
,
DocstringRefNode
)
from
PyrexTypes
import
py_object_type
from
Builtin
import
dict_type
from
StringEncoding
import
EncodedString
...
...
@@ -77,37 +77,3 @@ class DoctestHackTransform(ScopeTrackingTransform):
self
.
add_test
(
node
.
pos
,
name
,
getfunc
)
return
node
class
ModuleRefNode
(
ExprNode
):
type
=
py_object_type
is_temp
=
False
subexprs
=
[]
def
analyse_types
(
self
,
env
):
pass
def
calculate_result_code
(
self
):
return
Naming
.
module_cname
def
generate_result_code
(
self
,
code
):
pass
class
DocstringRefNode
(
ExprNode
):
# Extracts the docstring of the body element
subexprs
=
[
'body'
]
type
=
py_object_type
is_temp
=
True
def
__init__
(
self
,
pos
,
body
):
ExprNode
.
__init__
(
self
,
pos
)
assert
body
.
type
.
is_pyobject
self
.
body
=
body
def
analyse_types
(
self
,
env
):
pass
def
generate_result_code
(
self
,
code
):
code
.
putln
(
'%s = __Pyx_GetAttrString(%s, "__doc__");'
%
(
self
.
result
(),
self
.
body
.
result
()))
code
.
put_gotref
(
self
.
result
())
Cython/Compiler/ExprNodes.py
View file @
fa9cca20
...
...
@@ -5484,6 +5484,44 @@ class CloneNode(CoercionNode):
pass
class
ModuleRefNode
(
ExprNode
):
# Simple returns the module object
type
=
py_object_type
is_temp
=
False
subexprs
=
[]
def
analyse_types
(
self
,
env
):
pass
def
calculate_result_code
(
self
):
return
Naming
.
module_cname
def
generate_result_code
(
self
,
code
):
pass
class
DocstringRefNode
(
ExprNode
):
# Extracts the docstring of the body element
subexprs
=
[
'body'
]
type
=
py_object_type
is_temp
=
True
def
__init__
(
self
,
pos
,
body
):
ExprNode
.
__init__
(
self
,
pos
)
assert
body
.
type
.
is_pyobject
self
.
body
=
body
def
analyse_types
(
self
,
env
):
pass
def
generate_result_code
(
self
,
code
):
code
.
putln
(
'%s = __Pyx_GetAttrString(%s, "__doc__");'
%
(
self
.
result
(),
self
.
body
.
result
()))
code
.
put_gotref
(
self
.
result
())
#------------------------------------------------------------------------------------
#
# Runtime support code
...
...
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