Skip to content

Commit

Permalink
option to check only ecma syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
alexzhornyak committed Feb 23, 2021
1 parent 237cac3 commit f8c9eba
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,17 +318,19 @@ namespace uscxml {
JSObjectSetProperty(_ctx, JSContextGetGlobalObject(_ctx), ioProcName, jsIOProc, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, NULL);
JSStringRelease(ioProcName);

JSStringRef nameName = JSStringCreateWithUTF8CString("_name");
JSStringRef name = JSStringCreateWithUTF8CString(uscxml::fromLocaleToUtf8(_callbacks->getName()).c_str());
JSObjectSetProperty(_ctx, JSContextGetGlobalObject(_ctx), nameName, JSValueMakeString(_ctx, name), kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, NULL);
JSStringRelease(nameName);
JSStringRelease(name);

JSStringRef sessionIdName = JSStringCreateWithUTF8CString("_sessionid");
JSStringRef sessionId = JSStringCreateWithUTF8CString(uscxml::fromLocaleToUtf8(_callbacks->getSessionId()).c_str());
JSObjectSetProperty(_ctx, JSContextGetGlobalObject(_ctx), sessionIdName, JSValueMakeString(_ctx, sessionId), kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, NULL);
JSStringRelease(sessionIdName);
JSStringRelease(sessionId);
if (_callbacks) {
JSStringRef nameName = JSStringCreateWithUTF8CString("_name");
JSStringRef name = JSStringCreateWithUTF8CString(uscxml::fromLocaleToUtf8(_callbacks->getName()).c_str());
JSObjectSetProperty(_ctx, JSContextGetGlobalObject(_ctx), nameName, JSValueMakeString(_ctx, name), kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, NULL);
JSStringRelease(nameName);
JSStringRelease(name);

JSStringRef sessionIdName = JSStringCreateWithUTF8CString("_sessionid");
JSStringRef sessionId = JSStringCreateWithUTF8CString(uscxml::fromLocaleToUtf8(_callbacks->getSessionId()).c_str());
JSObjectSetProperty(_ctx, JSContextGetGlobalObject(_ctx), sessionIdName, JSValueMakeString(_ctx, sessionId), kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, NULL);
JSStringRelease(sessionIdName);
JSStringRelease(sessionId);
}

evalAsValue("_x = {};");
}
Expand Down Expand Up @@ -671,12 +673,18 @@ namespace uscxml {
JSStringRelease(scriptJS);

if (exception) {
try {
handleException(exception, script);
}
catch (uscxml::ErrorEvent &e) {
LOG(_callbacks->getLogger(), USCXML_ERROR) << e << std::endl;
if (_callbacks) {
try {
handleException(exception, script);
}
catch (uscxml::ErrorEvent &e) {
LOG(_callbacks->getLogger(), USCXML_ERROR) << e << std::endl;
}
}
else {
/* option to use for external syntax check */
handleException(exception, script);
}
return false;
}

Expand Down Expand Up @@ -830,7 +838,7 @@ namespace uscxml {
e.name = "error.execution";
e.eventType = uscxml::Event::PLATFORM;

if (!_callbacks->getName().empty()) {
if (_callbacks && !_callbacks->getName().empty()) {
e.data.compound["interpreter"] = Data(_callbacks->getName(), Data::VERBATIM);
}
if (!description.empty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace uscxml {
*
* ECMAScript data-model via JavaScriptCore.
*/
class JSCDataModel : public DataModelImpl {
class USCXML_API JSCDataModel : public DataModelImpl {
public:
JSCDataModel();
virtual ~JSCDataModel();
Expand Down

0 comments on commit f8c9eba

Please sign in to comment.