Hi Jim,
Sebastian
qx.ui.table.TablePane[127]
007249: Modification of property "visibleRowCount" failed with
exception:
TypeError - '$f' is null or not an object (#-2146823281
It seems the error is due to some problem in the new variableoptimizer
module: when a property of
an object is used as an accessor (because it is an array-type or
because it follows a function or method call)
and at the same time there is an optimized variable with the same name,
the property gets substituted with
the optimized variable name, while it should not. In effect this
problem shows up in various tests, not only in Table_5.
While analyzing the problem I also found two other bugs:
- variableoptimizer doesn't substitute function names with their
optimized value in the global scope
- in the tree module, the replaceChild() method doesn't assign the
"parent" property to newChild
I attach two patches which correct the above problems, so that
Sebastian can
evaluate them, though I am not entirely satisfied with the
variableoptimizer patch since
it explicitly handles the above two special cases while I suspect there
can be other,
but for now it works ok.
Cheers,
Alessandro
Index: tree.py
===================================================================
--- tree.py (revisione 4417)
+++ tree.py (copia locale)
@@ -64,6 +64,7 @@
def replaceChild(self, oldChild, newChild):
if self.hasChildren():
self.children.insert(self.children.index(oldChild), newChild)
+ newChild.parent = self
self.children.remove(oldChild)
def getChild(self, type, mandatory = True):
Index: variableoptimizer.py
===================================================================
--- variableoptimizer.py (revisione 4425)
+++ variableoptimizer.py (copia locale)
@@ -52,13 +52,32 @@
# Replace variables in current scope
update(node, list, prefix)
+ # File closed, update global code
+ elif node.type == "file":
+ # Iterate over content
+ # Replace variables in current scope
+ update(node, list, prefix)
def update(node, list, prefix="$"):
# Handle all identifiers
if node.type == "identifier":
+
+ isFirstChild = False
+ isVariableMember = False
+
+ if node.parent.type == "variable":
+ isVariableMember = True
+ varParent = node.parent.parent
+ if not (varParent.type == "right" and varParent.parent.type == "accessor"):
+ isFirstChild = (node.parent.getFirstChild(True, True) == node)
+ elif node.parent.type == "identifier" and node.parent.parent.type == "accessor":
+ isVariableMember = True
+ accessor = node.parent.parent
+ isFirstChild = (accessor.parent.getFirstChild(True, True) == accessor)
+
# inside a variable parent only respect the first member
- if node.parent.type != "variable" or node.parent.getFirstChild(True, True) == node:
+ if not isVariableMember or isFirstChild:
idenName = node.get("name", False)
if idenName != None and idenName in list:
@@ -77,6 +96,16 @@
# print " - Replaced '%s' with '%s'" % (idenName, replName)
+ # Handle function definition
+ elif node.type == "function":
+ idenName = node.get("name", False)
+
+ if idenName != None and idenName in list:
+ replName = "%s%s" % (prefix, mapper.convert(list.index(idenName)))
+ node.set("name", replName)
+
+ # print " - Replaced '%s' with '%s'" % (idenName, replName)
+
# Iterate over children
if node.hasChildren():
for child in node.children:
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel