Package lombok.ast

Examples of lombok.ast.Node


        Object nativeNode = node.getNativeNode();
        if (nativeNode != null) {
            return nativeNode;
        }

        Node parent = node.getParent();
        // The ECJ native nodes are sometimes spotty; for example, for a
        // MethodInvocation node we can have a null native node, but its
        // parent expression statement will point to the real MessageSend node
        if (parent != null) {
            nativeNode = parent.getNativeNode();
            if (nativeNode != null) {
                return nativeNode;
            }
        }
View Full Code Here


  public Node createEmptyStatement() {
    return posify(new EmptyStatement());
  }
 
  public Node createLabelledStatement(List<Node> labelNames, Node statement) {
    Node current = statement;
    if (labelNames != null) {
      labelNames = Lists.newArrayList(labelNames);
      Collections.reverse(labelNames);
      for (Node n : labelNames) {
        if (n != null) {
          Position pos = current == null ? null : new Position(n.getPosition().getStart(), current.getPosition().getEnd());
          current = new LabelledStatement().astLabel(createIdentifierIfNeeded(n, currentPos())).rawStatement(current);
          current.setPosition(pos);
        }
      }
    }
    return current;
  }
View Full Code Here

      if (imports.explicits.contains(wanted)) break potentialMatchFound;
      return false;
    }
   
    //name is definitely a simple name, and it might match. Walk up type tree and if it doesn't match any of those, delve into import statements.
    Node n = typeReference.getParent();
    Node prevN = null;
    CompilationUnit cu = null;
    while (n != null) {
      RawListAccessor<?, ?> list;
      boolean stopAtSelf;
     
View Full Code Here

  }
 
  private void checkStaticChain(Modifiers modifiers) {
    if (!modifiers.isStatic()) return;
   
    Node p = modifiers.getParent();
    while (p != null) {
      if (p instanceof CompilationUnit) return;
      if (p instanceof TypeDeclaration) {
        Modifiers pMods = ((TypeDeclaration)p).astModifiers();
        if (!pMods.isStatic()) {
          modifiers.getParent().addMessage(error(MODIFIERS_STATIC_CHAIN,
              "This declaration is (effectively) static; static declarations or only legal in top-level and static declarations."));
        }
      }
      p = p.getParent();
    }
  }
View Full Code Here

    if (!node.astVarargs()) return;
    if (node.getParent() == null) return;
   
    MethodDeclaration md = node.upIfParameterToMethodDeclaration();
    ConstructorDeclaration cd = node.upIfParameterToConstructorDeclaration();
    Node last;
   
    if (md != null) last = md.astParameters().last();
    else if (cd != null) last = cd.astParameters().last();
    else last = null;
   
View Full Code Here

    } else DanglingNodes.addDanglingNode(decl, params);
   
    decl.astMethodName(createIdentifierIfNeeded(name, currentPos())).rawBody(body);
    if (modifiers != null) decl.astModifiers(createModifiersIfNeeded(modifiers, currentPos()));
    int extraDims = dims == null ? 0 : dims.size();
    Node returnType = resultType;
    if (extraDims > 0 && returnType instanceof TypeReference) {
      ((TypeReference)returnType).astArrayDimensions(((TypeReference)returnType).astArrayDimensions() + extraDims);
    }
    decl.rawReturnTypeReference(returnType);
    if (typeParameters instanceof TemporaryNode.OrphanedTypeVariables) {
View Full Code Here

    }
    return posify(decl);
  }
 
  public Node createAnnotationDeclaration(Node modifiers, Node name, List<Node> members, org.parboiled.Node<Node> typeOpen, org.parboiled.Node<Node> typeClose) {
    Node typeBody = createNormalTypeBody(members);
    if (typeOpen != null && typeClose != null) {
      typeBody.setPosition(new Position(typeOpen.getStartIndex(), typeClose.getEndIndex()));
    }
    AnnotationDeclaration decl = new AnnotationDeclaration().astName(createIdentifierIfNeeded(name, currentPos())).rawBody(typeBody);
    if (modifiers != null) decl.astModifiers(createModifiersIfNeeded(modifiers, currentPos()));
    return posify(decl);
  }
View Full Code Here

  public Node createAnnotationMethodDeclaration(Node modifiers, Node typeReference, Node name, List<org.parboiled.Node<Node>> dims, Node defaultValue) {
    AnnotationMethodDeclaration decl = new AnnotationMethodDeclaration()
        .astMethodName(createIdentifierIfNeeded(name, currentPos())).rawDefaultValue(defaultValue);
    if (modifiers != null) decl.astModifiers(createModifiersIfNeeded(modifiers, currentPos()));
    int extraDims = dims == null ? 0 : dims.size();
    Node returnType = typeReference;
    if (extraDims > 0 && returnType instanceof TypeReference) {
      ((TypeReference)returnType).astArrayDimensions(((TypeReference)returnType).astArrayDimensions() + extraDims);
    }
    decl.rawReturnTypeReference(returnType);
    return posify(decl);
View Full Code Here

      setConversionStructureInfo(m, "converted");
      set(node, m);
    }
   
    @Override public void visitBlock(JCBlock node) {
      Node n;
      Block b = new Block();
      fillList(node.stats, b.rawContents());
      setPos(node, b);
      if (hasFlag(FlagKey.BLOCKS_ARE_INITIALIZERS)) {
        if ((node.flags & Flags.STATIC) != 0) {
View Full Code Here

   
    @Override public void visitSelect(JCFieldAccess node) {
      String name = node.getIdentifier().toString();
     
      Identifier id = setPos(node, new Identifier().astValue(name));
      Node selected = toTree(node.selected, params);
     
      if (hasFlag(FlagKey.TYPE_REFERENCE)) {
        TypeReference parent = (TypeReference) selected;
        parent.astParts().addToEnd(setPos(node, new TypeReferencePart().astIdentifier(id)));
        set(node, parent);
View Full Code Here

TOP

Related Classes of lombok.ast.Node

Copyright © 2018 www.massapicom. 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.