Showing the changes to libraries/script-engine/src/ArrayBufferClass.cpp (1 of 24 files). Show all
Unified · Split
| @@ -33,11 +33,11 @@ QObject(scriptEngine), · 32 unmodified lines | ||
| 33 | 33 | QScriptClass(scriptEngine) { |
| 34 | 34 | qScriptRegisterMetaType<QByteArray>(engine(), toScriptValue, fromScriptValue); |
| 35 | 35 | QScriptValue global = engine()->globalObject(); |
| 36 | − | |
| 36 | + | |
| 37 | 37 | // Save string handles for quick lookup |
| 38 | 38 | _name = engine()->toStringHandle(CLASS_NAME.toLatin1()); |
| 39 | 39 | _byteLength = engine()->toStringHandle(BYTE_LENGTH_PROPERTY_NAME.toLatin1()); |
| 40 | − | |
| 40 | + | |
| 41 | 41 | // build prototype |
| 42 | 42 | _proto = engine()->newQObject(new ArrayBufferPrototype(this), |
| 43 | 43 | QScriptEngine::QtOwnership, |
| @@ -45,13 +45,13 @@ QScriptClass(scriptEngine) { · 1 unmodified line | ||
| 45 | 45 | QScriptEngine::ExcludeSuperClassMethods | |
| 46 | 46 | QScriptEngine::ExcludeSuperClassProperties); |
| 47 | 47 | _proto.setPrototype(global.property("Object").property("prototype")); |
| 48 | − | |
| 48 | + | |
| 49 | 49 | // Register constructor |
| 50 | 50 | _ctor = engine()->newFunction(construct, _proto); |
| 51 | 51 | _ctor.setData(engine()->toScriptValue(this)); |
| 52 | − | |
| 52 | + | |
| 53 | 53 | engine()->globalObject().setProperty(name(), _ctor); |
| 54 | − | |
| 54 | + | |
| 55 | 55 | // Registering other array types |
| 56 | 56 | // The script engine is there parent so it'll delete them with itself |
| 57 | 57 | new DataViewClass(scriptEngine); |
| @@ -101,16 +101,16 @@ QScriptValue ArrayBufferClass::construct(QScriptContext* context, QScriptEngine* · 43 unmodified lines | ||
| 101 | 101 | if (!arg.isValid() || !arg.isNumber()) { |
| 102 | 102 | return QScriptValue(); |
| 103 | 103 | } |
| 104 | − | |
| 104 | + | |
| 105 | 105 | quint32 size = arg.toInt32(); |
| 106 | 106 | QScriptValue newObject = cls->newInstance(size); |
| 107 | − | |
| 107 | + | |
| 108 | 108 | if (context->isCalledAsConstructor()) { |
| 109 | 109 | // if called with keyword new, replace this object. |
| 110 | 110 | context->setThisObject(newObject); |
| 111 | 111 | return engine->undefinedValue(); |
| 112 | 112 | } |
| 113 | − | |
| 113 | + | |
| 114 | 114 | return newObject; |
| 115 | 115 | } |
| 116 | 116 | |