Files
codeql/javascript/ql/lib/semmle/javascript/Errors.qll
Andrew Eisenberg 45d1fa7f01 Packaging: Rafactor Javascript core libraries
Extract the external facing `qll` files into the codeql/javascript-all
query pack.
2021-08-25 12:15:56 -07:00

30 lines
1004 B
Plaintext

/** Provides classes for working with syntax errors. */
import javascript
/** An error encountered during extraction. */
abstract class Error extends Locatable {
override Location getLocation() { hasLocation(this, result) }
/** Gets the message associated with this error. */
abstract string getMessage();
override string toString() { result = getMessage() }
/** Holds if this error prevented the file from being extracted. */
predicate isFatal() { any() }
}
/** A JavaScript parse error encountered during extraction. */
class JSParseError extends @js_parse_error, Error {
/** Gets the toplevel element this error occurs in. */
TopLevel getTopLevel() { js_parse_errors(this, result, _, _) }
override string getMessage() { js_parse_errors(this, _, result, _) }
/** Gets the source text of the line this error occurs on. */
string getLine() { js_parse_errors(this, _, _, result) }
override predicate isFatal() { not getTopLevel() instanceof Angular2::TemplateTopLevel }
}