refactored AltLabelStructDecl to use es6 class

This commit is contained in:
Camilo Roca 2020-03-20 13:51:01 +01:00
parent 8b7ac991bf
commit 176f852bf1
1 changed files with 6 additions and 5 deletions

View File

@ -701,11 +701,12 @@ class <struct.name> extends <if(contextSuperClass)><contextSuperClass><else>antl
>>
AltLabelStructDecl(struct,attrs,getters,dispatchMethods) ::= <<
function <struct.name>(parser, ctx) {
<currentRule.name; format="cap">Context.call(this, parser);
<attrs:{a | <a>;}; separator="\n">
<currentRule.name; format="cap">Context.prototype.copyFrom.call(this, ctx);
return this;
class <struct.name> extends <currentRule.name; format="cap">Context {
constructor(parser, ctx) {
super(parser);
<attrs:{a | <a>;}; separator="\n">
<currentRule.name; format="cap">Context.prototype.copyFrom.call(this, ctx);
}
}
<struct.name>.prototype = Object.create(<currentRule.name; format="cap">Context.prototype);