Ignore:
Timestamp:
Jun 25, 2010, 6:39:17 AM (15 years ago)
Author:
[email protected]
Message:

2010-06-25 Jedrzej Nowacki <[email protected]>

Reviewed by Simon Hausmann.

New QtScript API; setPrototype() and prototype().

This patch implements QScriptValue's prototype accessors.

[Qt] QScriptValue should have accessors to a prototype.
https://bugs.webkit.org/show_bug.cgi?id=39356

  • qt/api/qscriptvalue.cpp: (QScriptValue::prototype): (QScriptValue::setPrototype):
  • qt/api/qscriptvalue.h:
  • qt/api/qscriptvalue_p.h: (QScriptValuePrivate::prototype): (QScriptValuePrivate::setPrototype):
  • qt/tests/qscriptvalue/tst_qscriptvalue.cpp: (tst_QScriptValue::getSetPrototype):
  • qt/tests/qscriptvalue/tst_qscriptvalue.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/qt/api/qscriptvalue.cpp

    r60725 r61860  
    516516        return QScriptEnginePrivate::get(engine);
    517517    return 0;
     518}
     519
     520/*!
     521  If this QScriptValue is an object, returns the internal prototype
     522  (\c{__proto__} property) of this object; otherwise returns an
     523  invalid QScriptValue.
     524
     525  \sa setPrototype(), isObject()
     526*/
     527QScriptValue QScriptValue::prototype() const
     528{
     529    return QScriptValuePrivate::get(d_ptr->prototype());
     530}
     531
     532/*!
     533  If this QScriptValue is an object, sets the internal prototype
     534  (\c{__proto__} property) of this object to be \a prototype;
     535  otherwise does nothing.
     536
     537  The internal prototype should not be confused with the public
     538  property with name "prototype"; the public prototype is usually
     539  only set on functions that act as constructors.
     540
     541  \sa prototype(), isObject()
     542*/
     543void QScriptValue::setPrototype(const QScriptValue& prototype)
     544{
     545    d_ptr->setPrototype(QScriptValuePrivate::get(prototype));
    518546}
    519547
Note: See TracChangeset for help on using the changeset viewer.