History

rework ScriptValue to act like a stack variable rather than a pointer

Heather Anderson committed 5 years ago

Commit 85810221 parent f209c51170 files · +2837 −2594Browse files

Showing the changes to libraries/script-engine/src/WebSocketServerClass.cpp (1 of 170 files). Show all

Unified · Split

libraries/script-engine/src/WebSocketServerClass.cpp+9−9
@@ -26,21 +26,21 @@ WebSocketServerClass::WebSocketServerClass(ScriptEngine* engine, const QString& · 25 unmodified lines
2626 }
2727 }
2828
29−ScriptValuePointer WebSocketServerClass::constructor(ScriptContext* context, ScriptEngine* engine) {
29+ScriptValue WebSocketServerClass::constructor(ScriptContext* context, ScriptEngine* engine) {
3030 // the serverName is used in handshakes
3131 QString serverName = QStringLiteral("HighFidelity - Scripted WebSocket Listener");
3232 // port 0 will auto-assign a free port
3333 quint16 port = 0;
34− ScriptValuePointer callee = context->callee();
34+ ScriptValue callee = context->callee();
3535 if (context->argumentCount() > 0) {
36− ScriptValuePointer options = context->argument(0);
37− ScriptValuePointer portOption = options->property(QStringLiteral("port"));
38− if (portOption->isValid() && portOption->isNumber()) {
39− port = portOption->toNumber();
36+ ScriptValue options = context->argument(0);
37+ ScriptValue portOption = options.property(QStringLiteral("port"));
38+ if (portOption.isValid() && portOption.isNumber()) {
39+ port = portOption.toNumber();
4040 }
41− ScriptValuePointer serverNameOption = options->property(QStringLiteral("serverName"));
42− if (serverNameOption->isValid() && serverNameOption->isString()) {
43− serverName = serverNameOption->toString();
41+ ScriptValue serverNameOption = options.property(QStringLiteral("serverName"));
42+ if (serverNameOption.isValid() && serverNameOption.isString()) {
43+ serverName = serverNameOption.toString();
4444 }
4545 }
4646 return engine->newQObject(new WebSocketServerClass(engine, serverName, port), ScriptEngine::ScriptOwnership);