Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "Added platform merge for simple class attribute assignments"

This reverts commit 87e736b5591a4a2e6a3570a8c1a605e1258975ea.

git-svn-id: https://pyjamas.svn.sourceforge.net/svnroot/pyjamas/trunk@682 7a2bd370-bda8-463c-979e-2900ccfb811e
  • Loading branch information...
commit 522fe55f1035e3846fe44d0d98ede5ee0e10db83 1 parent 976f8d1
lkcl authored
2  library/pyjamas/DOM.py
View
@@ -21,8 +21,6 @@
from pyjamas.Window import onResize, onClosing, onClosed
from pyjamas.__pyjamas__ import JS, doc, get_main_frame, wnd
- currentEvent = None
-
sCaptureElem = None
sEventPreviewStack = []
global sCaptureElem
4 library/pyjamas/Window.py
View
@@ -16,8 +16,6 @@
closingListeners = []
resizeListeners = []
else:
- from __pyjamas__ import JS
- from __pyjamas__ import unescape # for Location IE6 and Opera
closingListeners = None
resizeListeners = None
@@ -172,5 +170,3 @@ def fireResizedImpl():
def init():
pass
-
-init()
84 library/pyjamas/platform/DOMMozilla.py
View
@@ -24,27 +24,27 @@ def eventGetButton(evt):
""")
# This is what is in GWT 1.5 for getAbsoluteLeft. err...
-#"""
-# // We cannot use DOMImpl here because offsetLeft/Top return erroneous
-# // values when overflow is not visible. We have to difference screenX
-# // here due to a change in getBoxObjectFor which causes inconsistencies
-# // on whether the calculations are inside or outside of the element's
-# // border.
-# try {
-# return $doc.getBoxObjectFor(elem).screenX
-# - $doc.getBoxObjectFor($doc.documentElement).screenX;
-# } catch (e) {
-# // This works around a bug in the FF3 betas. The bug
-# // should be fixed before they release, so this can
-# // be removed at a later date.
-# // https://bugzilla.mozilla.org/show_bug.cgi?id=409111
-# // DOMException.WRONG_DOCUMENT_ERR == 4
-# if (e.code == 4) {
-# return 0;
-# }
-# throw e;
-# }
-#"""
+"""
+ // We cannot use DOMImpl here because offsetLeft/Top return erroneous
+ // values when overflow is not visible. We have to difference screenX
+ // here due to a change in getBoxObjectFor which causes inconsistencies
+ // on whether the calculations are inside or outside of the element's
+ // border.
+ try {
+ return $doc.getBoxObjectFor(elem).screenX
+ - $doc.getBoxObjectFor($doc.documentElement).screenX;
+ } catch (e) {
+ // This works around a bug in the FF3 betas. The bug
+ // should be fixed before they release, so this can
+ // be removed at a later date.
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=409111
+ // DOMException.WRONG_DOCUMENT_ERR == 4
+ if (e.code == 4) {
+ return 0;
+ }
+ throw e;
+ }
+"""
def getAbsoluteLeft(elem):
JS("""
try {
@@ -70,27 +70,27 @@ def getAbsoluteLeft(elem):
""")
# This is what is in GWT 1.5 for getAbsoluteTop. err...
-#"""
-# // We cannot use DOMImpl here because offsetLeft/Top return erroneous
-# // values when overflow is not visible. We have to difference screenY
-# // here due to a change in getBoxObjectFor which causes inconsistencies
-# // on whether the calculations are inside or outside of the element's
-# // border.
-# try {
-# return $doc.getBoxObjectFor(elem).screenY
-# - $doc.getBoxObjectFor($doc.documentElement).screenY;
-# } catch (e) {
-# // This works around a bug in the FF3 betas. The bug
-# // should be fixed before they release, so this can
-# // be removed at a later date.
-# // https://bugzilla.mozilla.org/show_bug.cgi?id=409111
-# // DOMException.WRONG_DOCUMENT_ERR == 4
-# if (e.code == 4) {
-# return 0;
-# }
-# throw e;
-# }
-#"""
+"""
+ // We cannot use DOMImpl here because offsetLeft/Top return erroneous
+ // values when overflow is not visible. We have to difference screenY
+ // here due to a change in getBoxObjectFor which causes inconsistencies
+ // on whether the calculations are inside or outside of the element's
+ // border.
+ try {
+ return $doc.getBoxObjectFor(elem).screenY
+ - $doc.getBoxObjectFor($doc.documentElement).screenY;
+ } catch (e) {
+ // This works around a bug in the FF3 betas. The bug
+ // should be fixed before they release, so this can
+ // be removed at a later date.
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=409111
+ // DOMException.WRONG_DOCUMENT_ERR == 4
+ if (e.code == 4) {
+ return 0;
+ }
+ throw e;
+ }
+"""
def getAbsoluteTop(elem):
JS("""
try {
7 library/pyjamas/platform/DOMPyJS.py
View
@@ -12,8 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-#from pyjamas.__pyjamas__ import JS
+from pyjamas.__pyjamas__ import JS
+sCaptureElem = None
+sEventPreviewStack = []
+currentEvent = None
def init():
JS("""
@@ -808,3 +811,5 @@ def insertListItem(select, item, value, index):
+init()
+
1  library/pyjamas/platform/LocationIE6.py
View
@@ -1,3 +1,4 @@
+from __pyjamas__ import unescape
class Location:
def getHash(self):
1  library/pyjamas/platform/LocationOpera.py
View
@@ -1,3 +1,4 @@
+from __pyjamas__ import unescape
class Location:
def getHash(self):
9 library/pyjamas/platform/WindowPyJS.py
View
@@ -1,3 +1,8 @@
+from __pyjamas__ import JS
+from pyjamas import Location
+
+closingListeners = None
+resizeListeners = None
def addWindowCloseListener(listener):
init_listeners()
@@ -58,6 +63,8 @@ def setLocation(url):
$wnd.location = url;
""")
+location = None
+
def getLocation():
global location
wnd_location = None
@@ -191,3 +198,5 @@ def init():
""")
setOnError(onError)
+init()
+
39 pyjs/pyjs.py
View
@@ -1247,7 +1247,6 @@ def _class(self, node):
elif isinstance(child, ast.Assign):
self.local_prefix = local_prefix
self.push_lookup(private_scope)
- self.track_lineno(child, True)
lhs = "%s.%s" % (local_prefix, child.nodes[0].name)
lhs = self.add_lookup('attribute', child.nodes[0].name, lhs)
print >>self.output, self.spacing() + "%s = %s" % (lhs, self.expr(child.expr, current_klass))
@@ -2079,8 +2078,6 @@ def parseModule(self, module_name, file_name):
if self.platform and os.path.isfile(platform_file_name):
mod = copy.deepcopy(mod)
mod_override = compiler.parseFile(platform_file_name)
- if self.verbose:
- print "Merging", module_name, self.platform
self.merge(mod, mod_override)
override = True
@@ -2104,8 +2101,6 @@ def merge(self, tree1, tree2):
self.replaceFunction(tree1, child.name, child)
elif isinstance(child, ast.Class):
self.replaceClassMethods(tree1, child.name, child)
- else:
- raise TranslationError("Do not know how to merge", child)
return tree1
@@ -2129,29 +2124,17 @@ def replaceClassMethods(self, tree, class_name, class_node):
raise TranslationError("class not found: " + class_name, class_node)
# replace methods
- for node in class_node.code:
- if isinstance(node, ast.Function):
+ for function_node in class_node.code:
+ if isinstance(function_node, ast.Function):
found = False
for child in old_class_node.code:
- if isinstance(child, ast.Function) and child.name == node.name:
+ if isinstance(child, ast.Function) and child.name == function_node.name:
found = True
- self.copyFunction(child, node)
+ self.copyFunction(child, function_node)
break
if not found:
- raise TranslationError("class method not found: " + class_name + "." + node.name, function_node)
- elif isinstance(node, ast.Assign) and \
- isinstance(node.nodes[0], ast.AssName):
- found = False
- for child in old_class_node.code:
- if isinstance(child, ast.Assign) and \
- self.eqNodes(child.nodes, node.nodes):
- found = True
- self.copyAssign(child, node)
- if not found:
- self.addCode(old_class_node.code, node)
- else:
- raise TranslationError("Do not know how to merge %s" % node, node)
+ raise TranslationError("class method not found: " + class_name + "." + function_node.name, function_node)
def copyFunction(self, target, source):
target.code = source.code
@@ -2159,18 +2142,6 @@ def copyFunction(self, target, source):
target.defaults = source.defaults
target.doc = source.doc # @@@ not sure we need to do this any more
- def copyAssign(self, target, source):
- target.nodes = source.nodes
- target.expr = source.expr
- target.lineno = source.lineno
- return
-
- def addCode(self, target, source):
- target.nodes.append(source)
-
- def eqNodes(self, nodes1, nodes2):
- return str(nodes1) == str(nodes2)
-
def dotreplace(fname):
path, ext = os.path.splitext(fname)
return path.replace(".", "/") + ext
Please sign in to comment.
Something went wrong with that request. Please try again.