Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QJSEngine evaluate giving a syntax error when script source contains class keywork
Forum Updated to NodeBB v4.3 + New Features

QJSEngine evaluate giving a syntax error when script source contains class keywork

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 164 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mike Gain
    wrote on last edited by Mike Gain
    #1

    I'm looking at maintaining some code making use of QJSEngine to evaluate some javascript code which before it is executed.

    The changes I've been making to the javascript files required me to add is several java script classes to the source but the QJSEngine evaluate is now reporting a sytax error, with the line number corresponding to my declaration of the class. Below is an example of what I have:

    'use strict';
    
    function MyCode() {
    ....
    }
    
    MyCode.prototype.run = function () {
       var myVar = new MyClass();
       myVar.docDoSomething();
    }
    
    class MyClass {
    ...
    }
    
    

    The code js code before did not use classes and evaluated without issue. Is this simply a restriction of QJSEnjine and I'll need to rethink my strategy for the javascript code?

    Thanks.

    Using QT 5.6.2

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved