parent
6fa8ad63f9
commit
5822596ab8
@ -1,18 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
let classes = require("./utils/classes");
|
||||
|
||||
/* Thrown when the grammar contains an error. */
|
||||
function GrammarError(message, location) {
|
||||
this.name = "GrammarError";
|
||||
this.message = message;
|
||||
this.location = location;
|
||||
class GrammarError {
|
||||
constructor(message, location) {
|
||||
this.name = "GrammarError";
|
||||
this.message = message;
|
||||
this.location = location;
|
||||
|
||||
if (typeof Error.captureStackTrace === "function") {
|
||||
Error.captureStackTrace(this, GrammarError);
|
||||
if (typeof Error.captureStackTrace === "function") {
|
||||
Error.captureStackTrace(this, GrammarError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
classes.subclass(GrammarError, Error);
|
||||
|
||||
module.exports = GrammarError;
|
||||
|
@ -1,12 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
/* Class utilities */
|
||||
let classes = {
|
||||
subclass: function(child, parent) {
|
||||
function ctor() { this.constructor = child; }
|
||||
ctor.prototype = parent.prototype;
|
||||
child.prototype = new ctor();
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = classes;
|
Loading…
Reference in New Issue