Skip to content

"class" keyword is not supported #471

@jaspertravers

Description

@jaspertravers

Attempting to asyncRun class syntax in the Stopify.org demo or as substituted into one of the Wiki's examples yields errors.

class myClass {
  constructor (a) {
    this.a = a;
  }
  display () {
    console.log(this.a);
  }
}

let myc = new myClass(2);
myc.display();

The simple example:

<html>
  <body>
    <script src="https://github.com/plasma-umass/Stopify/releases/download/0.7.2/stopify-full.bundle.js"></script>
    <script>
    const program = `
class myClass {
  constructor (a, b) {
    this.a = a;
  }
  display () {
    console.log(this.a);
  }
}

const myc = new myClass(2);
myc.display()
`;

    const asyncRun = stopify.stopifyLocally(program);
      asyncRun.g = { document, window, asyncRun, console };

    asyncRun.run(() => { });
    </script>
  </body>
</html>

returns the error: Uncaught TypeError: asyncRun.run is not a function.

It doesn't appear that any of the compiler options listed in the wiki relate to this issue, though I have tried both newMethod options. From digging around past issues it looks like classes were being transpiled with Babel, but also some efforts were made to remove Babel dependencies for web compilers and I cannot follow what changes might resolve the issue though I will keep digging.

Ocelot appears to have full es6 syntax available, so I'm digging around that repo to see if I can't find the solution there.

I have similar errors when using spread syntax {...spread}.

What am I missing here? Thanks in advance for the pointers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions