Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: third_party/cython/src/Cython/Compiler/CodeGeneration.py

Issue 385073004: Adding cython v0.20.2 in third-party. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reference cython dev list thread. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 from Cython.Compiler.Visitor import VisitorTransform
2 from Cython.Compiler.Nodes import StatListNode
3
4 class ExtractPxdCode(VisitorTransform):
5 """
6 Finds nodes in a pxd file that should generate code, and
7 returns them in a StatListNode.
8
9 The result is a tuple (StatListNode, ModuleScope), i.e.
10 everything that is needed from the pxd after it is processed.
11
12 A purer approach would be to seperately compile the pxd code,
13 but the result would have to be slightly more sophisticated
14 than pure strings (functions + wanted interned strings +
15 wanted utility code + wanted cached objects) so for now this
16 approach is taken.
17 """
18
19 def __call__(self, root):
20 self.funcs = []
21 self.visitchildren(root)
22 return (StatListNode(root.pos, stats=self.funcs), root.scope)
23
24 def visit_FuncDefNode(self, node):
25 self.funcs.append(node)
26 # Do not visit children, nested funcdefnodes will
27 # also be moved by this action...
28 return node
29
30 def visit_Node(self, node):
31 self.visitchildren(node)
32 return node
OLDNEW
« no previous file with comments | « third_party/cython/src/Cython/Compiler/Code.py ('k') | third_party/cython/src/Cython/Compiler/CythonScope.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698