[ZPT] CVS: Packages/TAL - TALGenerator.py:1.40 TALInterpreter.py:1.47
fred@digicool.com
fred@digicool.com
Fri, 8 Jun 2001 10:18:18 -0400 (EDT)
Update of /cvs-repository/Packages/TAL
In directory korak.digicool.com:/tmp/cvs-serv19316
Modified Files:
TALGenerator.py TALInterpreter.py
Log Message:
Merge the rawAttrs bytecode into the beginScope bytecode. These were only
emitted as a pair, so there is no need to separate them.
(This only gives a very minor performance boost, but it comes for free.)
--- Updated File TALGenerator.py in package Packages/TAL --
--- TALGenerator.py 2001/06/07 18:02:30 1.39
+++ TALGenerator.py 2001/06/08 14:18:17 1.40
@@ -416,8 +416,11 @@
self.pushProgram()
todo["defineSlot"] = defineSlot
if taldict:
- self.emit("beginScope")
- self.emit("rawAttrs", self.makeAttrDict(attrlist))
+ dict = {}
+ for item in attrlist:
+ key, value = item[:2]
+ dict[key] = value
+ self.emit("beginScope", dict)
todo["scope"] = 1
if onError:
self.pushProgram() # handler
@@ -457,13 +460,6 @@
self.todoPush(todo)
if isend:
self.emitEndElement(name, isend)
-
- def makeAttrDict(self, attrlist):
- dict = {}
- for item in attrlist:
- key, value = item[:2]
- dict[key] = value
- return dict
def emitEndElement(self, name, isend=0, implied=0):
todo = self.todoPop()
--- Updated File TALInterpreter.py in package Packages/TAL --
--- TALInterpreter.py 2001/06/07 18:02:13 1.46
+++ TALInterpreter.py 2001/06/08 14:18:17 1.47
@@ -389,9 +389,11 @@
self.col = self.col + len(s)
bytecode_handlers["endTag"] = do_endTag
- def do_beginScope(self):
+ def do_beginScope(self, dict):
self.engine.beginScope()
self.scopeLevel = self.scopeLevel + 1
+ if self.tal:
+ self.engine.setLocal("attrs", dict)
bytecode_handlers["beginScope"] = do_beginScope
def do_endScope(self):
@@ -410,11 +412,6 @@
value = self.engine.evaluateValue(expr)
self.engine.setGlobal(name, value)
bytecode_handlers["setGlobal"] = do_setGlobal
-
- def do_rawAttrs(self, dict):
- if self.tal:
- self.engine.setLocal("attrs", dict)
- bytecode_handlers["rawAttrs"] = do_rawAttrs
def do_insertText(self, expr, block):
if not self.tal: