Examples of parseCompilationUnit()


Examples of com.google.dart.engine.parser.Parser.parseCompilationUnit()

          new SubSequenceReader(contents, contentOffset),
          errorListener);
      scanner.setSourceStart(location.getLineNumber(), location.getColumnNumber());
      com.google.dart.engine.scanner.Token firstToken = scanner.tokenize();
      Parser parser = new Parser(getSource(), errorListener);
      CompilationUnit unit = parser.parseCompilationUnit(firstToken);
      unit.setLineInfo(lineInfo);
      tagNode.setScript(unit);
      return tagNode;
    }
    return new XmlTagNode(
View Full Code Here

Examples of com.google.dart.engine.parser.Parser.parseCompilationUnit()

    Scanner scanner = new Scanner(
        source,
        new CharSequenceReader(libraryFileContents),
        errorListener);
    Parser parser = new Parser(source, errorListener);
    CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize());
    LibraryBuilder libraryBuilder = new LibraryBuilder(useDart2jsPaths);
    // If any syntactic errors were found then don't try to visit the AST structure.
    if (!errorListener.getErrorReported()) {
      unit.accept(libraryBuilder);
    }
View Full Code Here

Examples of com.google.dart.engine.parser.Parser.parseCompilationUnit()

      AnalysisOptions options = getContext().getAnalysisOptions();
      parser.setParseFunctionBodies(options.getAnalyzeFunctionBodies());
      parser.setParseAsync(options.getEnableAsync());
      parser.setParseDeferredLibraries(options.getEnableDeferredLoading());
      parser.setParseEnum(options.getEnableEnum());
      unit = parser.parseCompilationUnit(tokenStream);
      unit.setLineInfo(lineInfo);
      AnalysisContext analysisContext = getContext();
      for (Directive directive : unit.getDirectives()) {
        if (directive instanceof PartOfDirective) {
          containsPartOfDirective = true;
View Full Code Here

Examples of com.sun.tools.javac.parser.Parser.parseCompilationUnit()

        JavaFileObject fo = new StringJavaFileObject("Foo", text);
        log.useSource(fo);

        CharSequence cs = fo.getCharContent(true);
        Parser parser = pfac.newParser(cs, false, genEndPos, false);
        JCTree.JCCompilationUnit tree = parser.parseCompilationUnit();
        log.setEndPosTable(fo, tree.endPositions);

        TreeScanner ts = new LogTester(log, tree.endPositions);
        ts.scan(tree);
View Full Code Here

Examples of lombok.ast.grammar.Source.parseCompilationUnit()

 
  @Test
  public void testBasicTypesMatch() {
    final AtomicInteger hit = new AtomicInteger();
    Source s = new Source(SIMPLE_SOURCE, "SimpleTypesMatchTest.java");
    s.parseCompilationUnit();
    s.getNodes().get(0).accept(new ForwardingAstVisitor() {
      @Override public boolean visitMethodDeclaration(MethodDeclaration node) {
        assertTrue("typesMatch with star import should match but fails:" + node.astReturnTypeReference(),
            new Resolver().typesMatch("java.util.List", node.astReturnTypeReference()));
        assertFalse("typesMatch with no relevant imports should fail but matches",
View Full Code Here

Examples of lombok.ast.grammar.Source.parseCompilationUnit()

      "}\n";
 
  @Test
  public void testMethodLocalMaskingTypesMatch() {
    Source s = new Source(METHOD_LOCAL_MASKING_SOURCE, "MaskingTypesMatchTest.java");
    s.parseCompilationUnit();
    final AtomicInteger hit1 = new AtomicInteger();
    final AtomicInteger hit2 = new AtomicInteger();
    s.getNodes().get(0).accept(new ForwardingAstVisitor() {
      @Override public boolean visitVariableDefinitionEntry(VariableDefinitionEntry node) {
        if ("thisIsAUtilList".equals(node.astName().astValue())) {
View Full Code Here

Examples of lombok.ast.grammar.Source.parseCompilationUnit()

      "}\n";
 
  @Test
  public void testInnerMaskingTypesMatch() {
    Source s = new Source(INNER_MASKING_SOURCE, "MaskingTypesMatchTest.java");
    s.parseCompilationUnit();
    final AtomicInteger hit = new AtomicInteger();
    s.getNodes().get(0).accept(new ForwardingAstVisitor() {
      @Override public boolean visitMethodDeclaration(MethodDeclaration node) {
        assertFalse("typesMatch with star import but should fail due to inner masking, yet succeeds.",
            new Resolver().typesMatch("java.util.List", node.astReturnTypeReference()));
View Full Code Here

Examples of lombok.ast.grammar.Source.parseCompilationUnit()

      "class List {}\n";
 
  @Test
  public void testTopLevelMaskingTypesMatch() {
    Source s = new Source(TOP_LEVEL_MASKING_SOURCE, "MaskingTypesMatchTest.java");
    s.parseCompilationUnit();
    final AtomicInteger hit = new AtomicInteger();
    s.getNodes().get(0).accept(new ForwardingAstVisitor() {
      @Override public boolean visitMethodDeclaration(MethodDeclaration node) {
        assertFalse("typesMatch with star import but should fail due to top level masking, yet succeeds.",
            new Resolver().typesMatch("java.util.List", node.astReturnTypeReference()));
View Full Code Here

Examples of lombok.ast.grammar.Source.parseCompilationUnit()

      "}";
 
  @Test
  public void testArrayTypesMatch() {
    Source s = new Source(ARRAYS_SOURCE, "ArrayTypesMatchTest.java");
    s.parseCompilationUnit();
    final AtomicInteger hit = new AtomicInteger();
    s.getNodes().get(0).accept(new ForwardingAstVisitor() {
      @Override public boolean visitMethodDeclaration(MethodDeclaration node) {
        assertTrue("typesMatch with String[] should match java.lang.String[] but doesn't.",
            new Resolver().typesMatch("java.lang.String[]", node.astReturnTypeReference()));
View Full Code Here

Examples of lombok.ast.grammar.Source.parseCompilationUnit()

      "}";
 
  @Test
  public void testImportedTypesMatch() {
    Source s = new Source(IMPORTS_SOURCE, "ImportsTest.java");
    s.parseCompilationUnit();
    final AtomicInteger hit = new AtomicInteger();
    s.getNodes().get(0).accept(new ForwardingAstVisitor() {
      @Override public boolean visitMethodDeclaration(MethodDeclaration node) {
        assertFalse("typesMatch with java.awt.List+java.util.* imported should NOT match java.util.List",
            new Resolver().typesMatch("java.util.List", node.astReturnTypeReference()));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.