[pypy-commit] lang-js default: handle get_binding_value properly

stepahn noreply at buildbot.pypy.org
Fri Dec 28 11:35:41 CET 2012


Author: Stephan <stephan at stzal.com>
Branch: 
Changeset: r319:16f3a9108e70
Date: 2012-12-11 17:41 +0100
http://bitbucket.org/pypy/lang-js/changeset/16f3a9108e70/

Log:	handle get_binding_value properly

diff --git a/js/environment_record.py b/js/environment_record.py
--- a/js/environment_record.py
+++ b/js/environment_record.py
@@ -108,7 +108,12 @@
     # 10.2.1.1.4
     def get_binding_value(self, identifier, strict=False):
         assert identifier is not None and isinstance(identifier, unicode)
-        assert self.has_binding(identifier)
+        if not self.has_binding(identifier):
+            if strict:
+                from js.execution import JsReferenceError
+                raise JsReferenceError(identifier)
+            else:
+                return w_Undefined
         return self._get_binding(identifier)
 
     # 10.2.1.1.5


More information about the pypy-commit mailing list