Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

194
Views
Is there a way to assign an ES5.1 class an anonym function?

I was trying to implement ANTLR4 for a project that i'm working on and I created a Python3 parser for JavaScript by using the ANTLR4 tool. The problem is that when I try to run the code, the following error is raised: TypeError: Assignment to constant variable.

TypeError: Assignment to constant variable.

The piece of code is the following: Assignment

      let old_lexer = Python3Lexer;
      Python3Lexer = function () {
        old_lexer.apply(this, arguments);
        this.reset.call(this);
      }

Python3Lexer is a class.

I am using ANTLR 4.9.2 and ECMAScript 5.1 (but I don't really know if this one is running, maybe it is the default version).

I don't really understand what does that assignment mean and also I don't really know if it can be written on some other way.

Thanks in advance.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Using ANTLR 4.9.x, the JavaScript target generates EcmaScript 6 source code and must be transpiled to EcmaScript 5 (Documentation for the JavaScript target recommends using WebPack and has instructions for using it.) The JavaScript runtime has a webpack.config.js to help out. This is necessary for output that will run under an EcmaScript 5.x runtime. (class, let, etc. are all ES6 specific).

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!