예제 #1
0
// ECMA 8.6.2.6 (new draft)
QSObject Imp::defaultValue(const QSObject *o, Type hint) const
{
#if 0
  QSObject obj;

  /* TODO String on Date object */
  if (hint != StringType && hint != NumberType)
    hint = NumberType;

  if (hint == StringType)
    obj = get(o, "toString");
  else
    obj = get(o, "valueOf");

  Imp *that = (Imp *)this;
  if (obj.isExecutable()) {   // spec says "not primitive type" but ...
    FunctionImp *f = (FunctionImp *)obj.imp();
    QSObject t(that);
    QSObject s = f->executeCall(&t, 0);
    if (!s.isObject())
      return s;
  }

  if (hint == StringType)
    obj = get(o, "valueOf");
  else
    obj = get(o, "toString");

  if (obj.isExecutable()) {
    FunctionImp *f = (FunctionImp *)obj.imp();
    QSObject t(that);
    QSObject s = f->executeCall(&t, 0);
    if (!s.isObject())
      return s;
  }
#endif
  return Error::create(TypeError, "No default value");
}
예제 #2
0
void QSList::remove( const QSObject &obj )
{
    if ( !obj.isValid() )
	return;
#if 0 // ###
    ListNode *n = hook->next;
    while ( n != hook ) {
	if ( n->member.imp() == obj.imp() ) {
	    erase( n );
	    return;
	}
	n = n->next;
    }
#endif
}