UNPKG

2.33 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.InvariantError = exports.InfeasiblePathError = exports.FatalError = exports.CompilerDiagnostic = void 0;
7
8/**
9 * Copyright (c) 2017-present, Facebook, Inc.
10 * All rights reserved.
11 *
12 * This source code is licensed under the BSD-style license found in the
13 * LICENSE file in the root directory of this source tree. An additional grant
14 * of patent rights can be found in the PATENTS file in the same directory.
15 */
16
17/* strict */
18// Information: Just an informative message with no semantic implications whatsoever.
19// Warning: Prepack will produce code that matches the behavior of the original code, but the original code might have an error.
20// RecoverableError: Prepack might produce code that deviates in behavior from the original code, if the original code is not well behaved.
21// FatalError: Prepack is unable to produce code that could possibly match the behavior of the original code.
22// This is the error format used to report errors to the caller-supplied
23// error-handler
24class CompilerDiagnostic extends Error {
25 constructor(message, location, errorCode, severity) {
26 super(message);
27 this.location = location;
28 this.severity = severity;
29 this.errorCode = errorCode;
30 }
31
32} // This error is thrown to exit Prepack when an ErrorHandler returns 'FatalError'
33// This should just be a class but Babel classes doesn't work with
34// built-in super classes.
35
36
37exports.CompilerDiagnostic = CompilerDiagnostic;
38
39class FatalError extends Error {
40 constructor(message) {
41 super(message === undefined ? "A fatal error occurred while prepacking." : message);
42 }
43
44} // This error is thrown when exploring a path whose entry conditon implies that an earlier path conditon must be false.
45// Such paths are infeasible (dead) and must be elided from the evaluation.
46
47
48exports.FatalError = FatalError;
49
50class InfeasiblePathError extends Error {
51 constructor() {
52 super("Infeasible path explored");
53 }
54
55} // This error is thrown when a false invariant is encountered. This error should never be swallowed.
56
57
58exports.InfeasiblePathError = InfeasiblePathError;
59
60class InvariantError extends Error {
61 constructor(message) {
62 super(message);
63 }
64
65}
66
67exports.InvariantError = InvariantError;
68//# sourceMappingURL=errors.js.map
\No newline at end of file