MCPcopy Create free account
hub / github.com/reactjs/react-rails / getAstForSource

Function getAstForSource

lib/assets/javascripts/JSXTransformer.js:12501–12515  ·  view source on GitHub ↗
(source, options)

Source from the content-addressed store, hash-verified

12499var _astCache = {};
12500
12501function getAstForSource(source, options) {
12502 if (_astCache[source] && !options.disableAstCache) {
12503 return _astCache[source];
12504 }
12505 var ast = esprima.parse(source, {
12506 comment: true,
12507 loc: true,
12508 range: true,
12509 sourceType: options.sourceType
12510 });
12511 if (!options.disableAstCache) {
12512 _astCache[source] = ast;
12513 }
12514 return ast;
12515}
12516
12517/**
12518 * Applies all available transformations to the source

Callers 1

transformFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected