refactored StructDel to use es6 class
This commit is contained in:
parent
42b9d8630c
commit
8b7ac991bf
|
@ -671,24 +671,22 @@ CaptureNextToken(d) ::= "<d.varName> = self._input.LT(1)"
|
|||
CaptureNextTokenType(d) ::= "<d.varName> = this._input.LA(1);"
|
||||
|
||||
StructDecl(struct,ctorAttrs,attrs,getters,dispatchMethods,interfaces,extensionMembers) ::= <<
|
||||
function <struct.name>(parser, parent, invokingState<struct.ctorAttrs:{a | , <a.name>}>) {
|
||||
if(parent===undefined) {
|
||||
parent = null;
|
||||
}
|
||||
if(invokingState===undefined || invokingState===null) {
|
||||
invokingState = -1;
|
||||
}
|
||||
<if(contextSuperClass)><contextSuperClass><else>antlr4.ParserRuleContext<endif>.call(this, parent, invokingState);
|
||||
this.parser = parser;
|
||||
this.ruleIndex = <parser.name>.RULE_<struct.derivedFromName>;
|
||||
<attrs:{a | <a>}; separator="\n">
|
||||
<struct.ctorAttrs:{a | this.<a.name> = <a.name> || null;}; separator="\n">
|
||||
return this;
|
||||
class <struct.name> extends <if(contextSuperClass)><contextSuperClass><else>antlr4.ParserRuleContext<endif> {
|
||||
constructor(parser, parent, invokingState<struct.ctorAttrs:{a | , <a.name>}>) {
|
||||
if(parent===undefined) {
|
||||
parent = null;
|
||||
}
|
||||
if(invokingState===undefined || invokingState===null) {
|
||||
invokingState = -1;
|
||||
}
|
||||
super(parent, invokingState);
|
||||
this.parser = parser;
|
||||
this.ruleIndex = <parser.name>.RULE_<struct.derivedFromName>;
|
||||
<attrs:{a | <a>}; separator="\n">
|
||||
<struct.ctorAttrs:{a | this.<a.name> = <a.name> || null;}; separator="\n">
|
||||
}
|
||||
}
|
||||
|
||||
<struct.name>.prototype = Object.create(<if(contextSuperClass)><contextSuperClass><else>antlr4.ParserRuleContext<endif>.prototype);
|
||||
<struct.name>.prototype.constructor = <struct.name>;
|
||||
|
||||
<getters:{g | <struct.name>.prototype.<g>}; separator="\n\n">
|
||||
|
||||
<if(struct.provideCopyFrom)> <! don't need copy unless we have subclasses !>
|
||||
|
|
Loading…
Reference in New Issue