00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 #include <spl/interp/JsArray.h>
00018 #include <spl/interp/JsMethod.h>
00019 
00020 JsMethod::JsMethod(const String& sourceCode)
00021 : m_src(sourceCode), m_prog()
00022 {
00023         throw new NotImplementedException();
00024 }
00025 
00026 JsMethod::JsMethod()
00027 : m_src("function anonymous( ) { [native code] }"), m_prog()
00028 {
00029 }
00030 
00031 JsMethod::JsMethod(const Program& prog)
00032 : m_src("function anonymous( ) { [native code] }"), m_prog(prog)
00033 {
00034 }
00035 
00036 JsMethod::JsMethod(const JsMethod& obj)
00037 : JsObject(obj), m_src(obj.m_src), m_prog(obj.m_prog)
00038 {
00039 }
00040 
00041 JsMethod::~JsMethod()
00042 {
00043 }
00044 
00045 IJsObjectPtr JsMethod::New() const
00046 {
00047         return IJsObjectPtr(new JsMethod(*this));
00048 }
00049 
00050 bool JsMethod::IsNative() const
00051 {
00052         return false;
00053 }
00054 
00055 VariantPtr JsMethod::Call(JsMethod *isthis, Vector<VariantPtr> args)
00056 {
00057         throw new Exception("Call of non native method");
00058 }
00059 
00060 VariantPtr JsMethod::GetProperty(const String& idx)
00061 {
00062         if ("arguments" == idx)
00063         {
00064         }
00065         return JsObject::GetProperty(idx);
00066 }
00067 
00068 bool JsMethod::HasProperty(const String& idx) const
00069 {
00070         return "arguments" == idx || JsObject::HasProperty(idx);
00071 }
00072 
00073 void JsMethod::SetProperty(const String& idx, VariantPtr obj)
00074 {
00075         JsObject::SetProperty(idx, obj);
00076 }
00077 
00078 bool JsMethod::Equals( const IComparable& a ) const
00079 {
00080         if (a.MajicNumber() != MajicNumber())
00081         {
00082                 return false;
00083         }
00084         
00085         return false;
00086 }
00087 
00088 int JsMethod::Compare( const IComparable& a ) const
00089 {
00090         if (a.MajicNumber() != MajicNumber())
00091         {
00092                 return -1;
00093         }
00094         
00095         return 0;
00096 }
00097 
00098 int32 JsMethod::MajicNumber() const
00099 {
00100         return JSMETHOD_MAJIC;
00101 }
00102 
00103 int32 JsMethod::HashCode() const
00104 {
00105         int32 hc = (int32)this;
00106         return hc;
00107 }
00108 
00109 StringPtr JsMethod::ToString() const
00110 {
00111         return m_src.ToString();
00112 }
00113 
00114 #if defined(DEBUG) || defined(_DEBUG)
00115 void JsMethod::CheckMem() const
00116 {
00117         JsObject::CheckMem();
00118         m_src.CheckMem();
00119         m_prog.CheckMem();
00120 }
00121 
00122 void JsMethod::ValidateMem() const
00123 {
00124         JsObject::ValidateMem();
00125         m_src.ValidateMem();
00126         m_prog.ValidateMem();
00127 }
00128 #endif
00129