[pypy-commit] lang-js default: added more meaningful constants for property flags

stepahn noreply at buildbot.pypy.org
Fri Dec 28 11:32:20 CET 2012


Author: Stephan <stephan at stzal.com>
Branch: 
Changeset: r122:a071cca2bfdb
Date: 2011-09-06 19:14 +0200
http://bitbucket.org/pypy/lang-js/changeset/a071cca2bfdb/

Log:	added more meaningful constants for property flags

diff --git a/js/jsexecution_context.py b/js/jsexecution_context.py
--- a/js/jsexecution_context.py
+++ b/js/jsexecution_context.py
@@ -1,5 +1,5 @@
 from js.utils import MapDict, StackMixin
-from js.jsobj import DD
+from js.jsobj import DONT_DELETE
 
 class JSContext(object):
     def __init__(self, parent=None):
@@ -38,7 +38,7 @@
         except KeyError:
             self.get_global_context().put(name, value, flags=0)
 
-    def declare_variable(self, identifier, flags=DD):
+    def declare_variable(self, identifier, flags=DONT_DELETE):
         from js.jsobj import w_Undefined, Property
         self.values.addname(identifier)
         p = Property(identifier, w_Undefined, flags)
@@ -99,7 +99,7 @@
         from jsobj import W_ContextObject
         return W_ContextObject(self)
 
-    def put(self, name, value, flags=DD):
+    def put(self, name, value, flags=DONT_DELETE):
         self.declare_variable(name, flags)
         self.assign(name, value)
 
diff --git a/js/jsobj.py b/js/jsobj.py
--- a/js/jsobj.py
+++ b/js/jsobj.py
@@ -10,10 +10,10 @@
 
 import string
 # see ECMA 8.6.1 Property attributes
-DE = 1 # DontEnum
-DD = 2 # DontDelete
-RO = 4 # ReadOnly
-IT = 8 # Internal
+DONT_ENUM = DE = 1 # DontEnum
+DONT_DELETE = DD = 2 # DontDelete
+READ_ONLY = RO = 4 # ReadOnly
+INTERNAL = IT = 8 # Internal
 
 class SeePage(NotImplementedError):
     pass


More information about the pypy-commit mailing list