63 |
63 |
64 namespace KJS { |
64 namespace KJS { |
65 |
65 |
66 static double parseDate(const UString&); |
66 static double parseDate(const UString&); |
67 static double timeClip(double); |
67 static double timeClip(double); |
|
68 |
|
69 |
|
70 static const Identifier* parsePropertyName = 0; |
|
71 static const Identifier* UTCPropertyName = 0; |
|
72 |
|
73 struct cleanupStaticDateObject { |
|
74 ~cleanupStaticDateObject() |
|
75 { |
|
76 delete parsePropertyName; |
|
77 delete UTCPropertyName; |
|
78 |
|
79 parsePropertyName = 0; |
|
80 UTCPropertyName = 0; |
|
81 } |
|
82 }; |
|
83 static cleanupStaticDateObject deleteStaticDateObject; |
68 |
84 |
69 inline int gmtoffset(const GregorianDateTime& t) |
85 inline int gmtoffset(const GregorianDateTime& t) |
70 { |
86 { |
71 return t.utcOffset; |
87 return t.utcOffset; |
72 } |
88 } |
623 DateObjectImp::DateObjectImp(ExecState *exec, |
639 DateObjectImp::DateObjectImp(ExecState *exec, |
624 FunctionPrototype *funcProto, |
640 FunctionPrototype *funcProto, |
625 DatePrototype *dateProto) |
641 DatePrototype *dateProto) |
626 : InternalFunctionImp(funcProto, dateProto->classInfo()->className ) |
642 : InternalFunctionImp(funcProto, dateProto->classInfo()->className ) |
627 { |
643 { |
628 static const Identifier* parsePropertyName = new Identifier("parse"); |
644 if(!parsePropertyName) |
629 static const Identifier* UTCPropertyName = new Identifier("UTC"); |
645 parsePropertyName = new Identifier("parse"); |
|
646 if(!UTCPropertyName) |
|
647 UTCPropertyName = new Identifier("UTC"); |
630 |
648 |
631 putDirect(exec->propertyNames().prototype, dateProto, DontEnum|DontDelete|ReadOnly); |
649 putDirect(exec->propertyNames().prototype, dateProto, DontEnum|DontDelete|ReadOnly); |
632 putDirectFunction(new DateObjectFuncImp(exec, funcProto, DateObjectFuncImp::Parse, 1, *parsePropertyName), DontEnum); |
650 putDirectFunction(new DateObjectFuncImp(exec, funcProto, DateObjectFuncImp::Parse, 1, *parsePropertyName), DontEnum); |
633 putDirectFunction(new DateObjectFuncImp(exec, funcProto, DateObjectFuncImp::UTC, 7, *UTCPropertyName), DontEnum); |
651 putDirectFunction(new DateObjectFuncImp(exec, funcProto, DateObjectFuncImp::UTC, 7, *UTCPropertyName), DontEnum); |
634 putDirect(exec->propertyNames().length, 7, ReadOnly|DontDelete|DontEnum); |
652 putDirect(exec->propertyNames().length, 7, ReadOnly|DontDelete|DontEnum); |