function _resolveGrammerCall()

in src/lib/helper.js [264:299]


function _resolveGrammerCall(grammer, dependencies) {
  if (!(grammer instanceof GrammerCall)) {
    return null;
  }
  if (grammer.path.length !== 2) {
    return null;
  }
  if (grammer.path[0].type !== 'object_static' || grammer.path[1].type !== 'call_static') {
    return null;
  }
  if (grammer.path[0].name[0] !== '^') {
    return null;
  }
  const name = grammer.path[0].name.substr(1);
  const scope = dependencies[name].scope;
  if (!scope) {
    return null;
  }
  const modules = config.modules;
  if (!modules[scope]) {
    return null;
  }
  const package_name = name;
  const method_name = grammer.path[1].name;
  const m = modules[scope];
  if (!m[package_name]) {
    return null;
  }
  const methods = m[package_name].methods;
  if (methods[method_name] === '') {
    return `${_toSnakeCase(scope)}_${_toSnakeCase(package_name)}_${_toSnakeCase(method_name)}`;
  } else if (!methods[method_name]) {
    return null;
  }
  return methods[method_name];
}