Declare message/assertion types, so latest babel doesn't complain about missing exports

This commit is contained in:
Tony Garnock-Jones 2019-05-16 08:47:26 +01:00
parent 7447a4d3dc
commit 31b3ef250d
2 changed files with 7 additions and 3 deletions

View File

@ -1,5 +1,6 @@
// Horrible, horrible, horrible, horrible hack to get hold of the Parser
// from babel-parser/src/parser/index.js.
// Horrible, horrible, horrible, horrible hack to get hold of (a) the
// Parser and (b) various flags and non-exported values from
// babel-parser/src/parser/index.js.
exports._original_Parser = Parser;
exports.__getParser = function () {
@ -8,3 +9,5 @@ exports.__getParser = function () {
exports.__setParser = function (newParser) {
Parser = newParser;
};
exports.BIND_LEXICAL = BIND_LEXICAL;

View File

@ -16,7 +16,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//---------------------------------------------------------------------------
import { _original_Parser, tokTypes as tt } from "@babel/parser";
import { _original_Parser, BIND_LEXICAL, tokTypes as tt } from "@babel/parser";
export default class SyndicateParser extends _original_Parser {
// Overrides ExpressionParser.parseMaybeAssign
@ -141,6 +141,7 @@ export default class SyndicateParser extends _original_Parser {
this.eatContextual("type");
if (!this.match(tt.name)) { this.unexpected(null, tt.name); }
node.id = this.parseIdentifier();
this.scope.declareName(node.id.name, BIND_LEXICAL, node.id.start);
this.parseFunctionParams(node); // eww
node.formals = node.params;
delete node.params; // eww