UNPKG

antlr-ng

Version:

Next generation ANTLR Tool

46 lines (45 loc) 1.27 kB
var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); import { MurmurHash } from "../../../support/MurmurHash.js"; import { Decl } from "./Decl.js"; class ContextGetterDecl extends Decl { static { __name(this, "ContextGetterDecl"); } // assume no args signature; constructor(factory, name, signature) { super(factory, name); this.signature = signature ?? false; } /** * Not used for output; just used to distinguish between decl types to avoid duplicates. */ getArgType() { return ""; } hashCode() { let hash = MurmurHash.initialize(); hash = MurmurHash.update(hash, this.name); hash = MurmurHash.update(hash, this.getArgType()); hash = MurmurHash.finish(hash, 2); return hash; } /** * Make sure that a getter does not equal a label. X() and X are ok. * OTOH, treat X() with two diff return values as the same. Treat * two X() with diff args as different. */ equals(obj) { if (this === obj) { return true; } if (!(obj instanceof ContextGetterDecl)) { return false; } return this.name === obj.name && this.getArgType() === obj.getArgType(); } } export { ContextGetterDecl };