History

Updated script isolation files

ksuprynowicz committed 4 years ago

Commit b4d21c31 parent 7e9ad399 files · +49 −33Browse files

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

Unified · Split

libraries/script-engine/src/ScriptManager.cpp+13−9
@@ -53,6 +53,7 @@ · 52 unmodified lines
53#include "ScriptEngines.h"53#include "ScriptEngines.h"
54#include "StackTestScriptingInterface.h"54#include "StackTestScriptingInterface.h"
55#include "ScriptValue.h"55#include "ScriptValue.h"
56#include "ScriptProgram.h"
56#include "ScriptValueIterator.h"57#include "ScriptValueIterator.h"
57#include "ScriptValueUtils.h"58#include "ScriptValueUtils.h"
58 59
@@ -1935,18 +1936,21 @@ void ScriptManager::entityScriptContentAvailable(const EntityItemID& entityID, c · 1876 unmodified lines
1935 }1936 }
1936 1937
1937 // SYNTAX ERRORS1938 // SYNTAX ERRORS
1938 auto syntaxError = _engine->lintScript(contents, fileName);1939 //auto syntaxError = _engine->lintScript(contents, fileName);
1939 if (syntaxError.isError()) {1940 auto program = _engine->newProgram( contents, fileName );
1940 auto message = syntaxError.property("formatted").toString();1941 auto syntaxCheck = program->checkSyntax();
1941 if (message.isEmpty()) {1942 if (syntaxCheck->state() != ScriptSyntaxCheckResult::Valid) {
1942 message = syntaxError.toString();1943 auto message = syntaxCheck->errorMessage();
1943 }1944 //syntaxError.property("formatted").toString();
1945 //if (message.isEmpty()) {
1946 // message = syntaxError.toString();
1947 //}
1944 setError(QString("Bad syntax (%1)").arg(message), EntityScriptStatus::ERROR_RUNNING_SCRIPT);1948 setError(QString("Bad syntax (%1)").arg(message), EntityScriptStatus::ERROR_RUNNING_SCRIPT);
1945 syntaxError.setProperty("detail", entityID.toString());1949 //syntaxError.setProperty("detail", entityID.toString());
1946 emit unhandledException(syntaxError);1950 //V8TODO
1951 //emit unhandledException(syntaxError);
1947 return;1952 return;
1948 }1953 }
1949 auto program = _engine->newProgram( contents, fileName );
1950 if (!program) {1954 if (!program) {
1951 setError("Bad program (isNull)", EntityScriptStatus::ERROR_RUNNING_SCRIPT);1955 setError("Bad program (isNull)", EntityScriptStatus::ERROR_RUNNING_SCRIPT);
1952 emit unhandledException(_engine->makeError(_engine->newValue("program.isNull")));1956 emit unhandledException(_engine->makeError(_engine->newValue("program.isNull")));