[pypy-svn] r65217 - pypy/branch/js-refactoring/pypy/lang/js

jandem at codespeak.net jandem at codespeak.net
Mon May 11 17:05:45 CEST 2009


Author: jandem
Date: Mon May 11 17:05:44 2009
New Revision: 65217

Modified:
   pypy/branch/js-refactoring/pypy/lang/js/interpreter.py
Log:
Add stub for Date, all Array tests pass :)


Modified: pypy/branch/js-refactoring/pypy/lang/js/interpreter.py
==============================================================================
--- pypy/branch/js-refactoring/pypy/lang/js/interpreter.py	(original)
+++ pypy/branch/js-refactoring/pypy/lang/js/interpreter.py	Mon May 11 17:05:44 2009
@@ -620,12 +620,12 @@
             newlength += 1
         return this
 
-class W_DateFake(W_NewBuiltin): # XXX This is temporary
+class W_DateObject(W_NativeObject):
     def Call(self, ctx, args=[], this=None):
         return create_object(ctx, 'Object')
     
     def Construct(self, ctx, args=[]):
-        return create_object(ctx, 'Object')
+        return create_object(ctx, 'Date', Value = W_FloatNumber(0.0))
 
 def pypy_repr(ctx, repr, w_arg):
     return W_String(w_arg.__class__.__name__)
@@ -802,7 +802,18 @@
         w_Global.Put(ctx, 'version', W_Builtin(versionjs), flags=allon)
         
         #Date
-        w_Date = W_DateFake(ctx, Class='Date')
+        w_Date = W_DateObject('Date', w_FncPrototype)
+
+        w_DatePrototype = create_object(ctx, 'Object', Value=W_String(''))
+        w_DatePrototype.Class = 'Date'
+        
+        put_values(ctx, w_DatePrototype, {
+            '__proto__': w_DatePrototype,
+            'valueOf': get_value_of('Date')(ctx),
+        })
+        
+        w_Date.Put(ctx, 'prototype', w_DatePrototype, flags=allon)
+        
         w_Global.Put(ctx, 'Date', w_Date)
         
         w_Global.Put(ctx, 'NaN', W_FloatNumber(NAN), flags = DE|DD)



More information about the Pypy-commit mailing list