Files
react-native-devtools-frontend/node_modules/recast/parsers/esprima.js
T
Tim van der Lippe dc4637c1a9 Update escodegen and recast
- Escodegen drops Node 6 support (unaffected) and introduces support
for optional chaining
- Recast drops Node <9 support (unaffected)

DISABLE_THIRD_PARTY_CHECK=NPM updates
R=jacktfranklin@chromium.org

Change-Id: I9eb8d294d3ad87a6469da9e0bc1114563abd4f07
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2537955
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-11-16 14:13:28 +00:00

31 lines
897 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parse = void 0;
// This module is suitable for passing as options.parser when calling
// recast.parse to process ECMAScript code with Esprima:
//
// const ast = recast.parse(source, {
// parser: require("recast/parsers/esprima")
// });
//
var util_1 = require("../lib/util");
function parse(source, options) {
var comments = [];
var ast = require("esprima").parse(source, {
loc: true,
locations: true,
comment: true,
onComment: comments,
range: util_1.getOption(options, "range", false),
tolerant: util_1.getOption(options, "tolerant", true),
tokens: true,
jsx: util_1.getOption(options, "jsx", false)
});
if (!Array.isArray(ast.comments)) {
ast.comments = comments;
}
return ast;
}
exports.parse = parse;
;