Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

189
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda