antlr-ng
Version:
Next generation ANTLR Tool
43 lines (42 loc) • 1.03 kB
JavaScript
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
import { MurmurHash } from "../../../support/MurmurHash.js";
import { SrcOp } from "../SrcOp.js";
class Decl extends SrcOp {
static {
__name(this, "Decl");
}
name;
escapedName;
/** Whole thing if copied from action. */
decl;
/** If local var (not in RuleContext struct). */
isLocal;
/** Which context contains us? set by addDecl. */
ctx;
constructor(factory, name, decl) {
super(factory);
this.name = name;
this.escapedName = factory.getGenerator().target.escapeIfNeeded(name);
this.decl = decl;
}
hashCode() {
return MurmurHash.hashCode(this.name);
}
/** If same name, can't redefine, unless it's a getter. */
equals(obj) {
if (this === obj) {
return true;
}
if (!(obj instanceof Decl)) {
return false;
}
if ("signature" in obj) {
return false;
}
return this.name === obj.name;
}
}
export {
Decl
};