Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

190
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda