Commit 4cd37022 authored by Fred Drake's avatar Fred Drake

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.)
parent 61b5c39f
......@@ -416,8 +416,11 @@ class TALGenerator:
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
......@@ -458,13 +461,6 @@ class TALGenerator:
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()
if not todo:
......
......@@ -389,9 +389,11 @@ class TALInterpreter:
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):
......@@ -411,11 +413,6 @@ class TALInterpreter:
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:
self.interpret(block)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment