当前位置: 首页>>代码示例>>Java>>正文


Java Node.getJsDocBuilderForNode方法代码示例

本文整理汇总了Java中com.google.javascript.rhino.Node.getJsDocBuilderForNode方法的典型用法代码示例。如果您正苦于以下问题:Java Node.getJsDocBuilderForNode方法的具体用法?Java Node.getJsDocBuilderForNode怎么用?Java Node.getJsDocBuilderForNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.javascript.rhino.Node的用法示例。


在下文中一共展示了Node.getJsDocBuilderForNode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: transformTree

import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
public static Node transformTree(AstRoot node,
                                 String sourceString,
                                 Config config,
                                 ErrorReporter errorReporter) {
  IRFactory irFactory = new IRFactory(sourceString, node.getSourceName(),
      config, errorReporter);
  Node irNode = irFactory.transform(node);
  // @license text gets appended onto the fileLevelJsDocBuilder as found,
  // and stored straight into the JSDocInfo for the root node.
  Node.FileLevelJsDocBuilder fileLevelJsDocBuilder =
      irNode.getJsDocBuilderForNode();
  // fileOverviewInfo stores the last bit of fileoverview data we saw.
  // We only permit one, so throwing away extras is fair.
  // The fileOverviewInfo gets passed into parseJSDocInfo so that
  // it can detect when multiple @fileoverviews exist in the same file.
  JSDocInfo fileOverviewInfo = null;
  if (node.getComments() != null) {
    for (Comment comment : node.getComments()) {
      if (comment.getCommentType() == JSDOC) {
        JsDocInfoParser jsDocParser =
            irFactory.createJsDocInfoParser(comment.getValue(),
                comment.getLineno(), comment.getAbsolutePosition(),
                fileLevelJsDocBuilder, fileOverviewInfo);
        if (jsDocParser.getFileOverviewJSDocInfo() != fileOverviewInfo) {
          fileOverviewInfo = jsDocParser.getFileOverviewJSDocInfo();
        } else {
          JSDocInfo info = jsDocParser.retrieveAndResetParsedJSDocInfo();
          if (info != null) {
            irFactory.attachJsDoc(comment, info);
          }
        }
      }
    }

    // Only after we've seen all @fileoverview entries, attach the
    // last one to the root node, and copy the found license strings
    // to that node.
    if (fileOverviewInfo != null) {
      if ((irNode.getJSDocInfo() != null) &&
          (irNode.getJSDocInfo().getLicense() != null)) {
        fileOverviewInfo.setLicense(irNode.getJSDocInfo().getLicense());
      }
      irNode.setJSDocInfo(fileOverviewInfo);
    }
  }
  return irNode;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:48,代码来源:IRFactory.java


注:本文中的com.google.javascript.rhino.Node.getJsDocBuilderForNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。