Package lombok.ast

Examples of lombok.ast.Identifier


    this.source = source;
  }
 
  Identifier createIdentifierIfNeeded(Node identifier, int pos) {
    if (identifier instanceof Identifier) return (Identifier)identifier;
    Identifier i = new Identifier();
    i.setPosition(new Position(pos, pos));
    DanglingNodes.addDanglingNode(i, identifier);
    return i;
  }
View Full Code Here


  public BasicsActions(Source source) {
    super(source);
  }
 
  public Node createIdentifier(String text, org.parboiled.Node<Node> rawIdentifier) {
    Identifier id = new Identifier();
    if (text != null) id.astValue(text);
   
    int start = rawIdentifier.getStartIndex();
    int end = Math.max(start, rawIdentifier.getEndIndex());
    id.setPosition(new Position(start, end));
    return id;
  }
View Full Code Here

  public TypesActions(Source source) {
    super(source);
  }
 
  public Node createPrimitiveType(String text) {
    Identifier identifier = posify(new Identifier().astValue(text));
    TypeReferencePart typeReferencePart = posify(new TypeReferencePart()
        .astIdentifier(identifier));
    return posify(new TypeReference().rawParts().addToStart(typeReferencePart));
  }
View Full Code Here

    }
   
    @Override public void visitImport(JCImport node) {
      ImportDeclaration imp = new ImportDeclaration();
      fillWithIdentifiers(node.getQualifiedIdentifier(), imp.astParts());
      Identifier last = imp.astParts().last();
      if (last != null && "*".equals(last.astValue())) {
        imp.astParts().remove(last);
        imp.astStarImport(true);
        setConversionPositionInfo(imp, ".*", last.getPosition());
      }
      imp.astStaticImport(node.isStatic());
      set(node, imp);
    }
View Full Code Here

            JCVariableDecl vd = (JCVariableDecl) def;
            if (vd.mods != null && (vd.mods.flags & ENUM_CONSTANT_FLAGS) == ENUM_CONSTANT_FLAGS) {
              // This is an enum constant, not a field of the enum class.
              EnumConstant ec = new EnumConstant();
              setPos(def, ec);
              ec.astName(new Identifier().astValue(vd.getName().toString()));
              fillList(vd.mods.annotations, ec.rawAnnotations());
              if (vd.init instanceof JCNewClass) {
                JCNewClass init = (JCNewClass) vd.init;
                fillList(init.getArguments(), ec.rawArguments());
                if (init.getClassBody() != null) {
                  NormalTypeBody constantBody = setPos(init, new NormalTypeBody());
                  fillList(init.getClassBody().getMembers(), constantBody.rawMembers());
                  ec.astBody(constantBody);
                }
                setConversionPositionInfo(ec, "newClass", getPosition(init));
              }
              body.astConstants().addToEnd(ec);
              continue;
            }
          }
         
          defs.add(def);
        }
        fillList(defs, body.rawMembers(), flagKeyMap);
        enumDecl.astBody(body);
      } else {
        throw new IllegalStateException("Unknown type declaration: " + node);
      }
     
      typeDecl.astName(new Identifier().astValue(name));
      typeDecl.astModifiers((Modifiers) toTree(node.mods));
      addJavadoc(typeDecl, node.mods);
      set(node, typeDecl);
    }
View Full Code Here

    @Override public void visitTypeIdent(JCPrimitiveTypeTree node) {
      String primitiveType = JcTreeBuilder.PRIMITIVES.inverse().get(node.typetag);
     
      if (primitiveType == null) throw new IllegalArgumentException("Uknown primitive type tag: " + node.typetag);
     
      TypeReferencePart part = setPos(node, new TypeReferencePart().astIdentifier(setPos(node, new Identifier().astValue(primitiveType))));
     
      set(node, new TypeReference().astParts().addToEnd(part));
    }
View Full Code Here

        set(node, s);
        setConversionPositionInfo(s, "super", getPosition(node));
        return;
      }
     
      Identifier id = setPos(node, new Identifier().astValue(name));
     
      if (hasFlag(FlagKey.TYPE_REFERENCE)) {
        TypeReferencePart part = setPos(node, new TypeReferencePart().astIdentifier(id));
        set(node, new TypeReference().astParts().addToEnd(part));
        return;
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)));
View Full Code Here

      }
    }
   
    @Override public void visitTypeParameter(JCTypeParameter node) {
      TypeVariable var = new TypeVariable();
      var.astName(setPos(node, new Identifier().astValue(node.name.toString())));
      fillList(node.bounds, var.rawExtending(), FlagKey.TYPE_REFERENCE);
      set(node, var);
    }
View Full Code Here

    }
   
    @Override public void visitApply(JCMethodInvocation node) {
      MethodInvocation inv = new MethodInvocation();
      JCTree sel = node.getMethodSelect();
      Identifier id = new Identifier();
      if (sel instanceof JCIdent) {
        String name = ((JCIdent) sel).getName().toString();
        if ("this".equals(name)) {
          AlternateConstructorInvocation aci = new AlternateConstructorInvocation();
          fillList(node.getTypeArguments(), aci.rawConstructorTypeArguments(), FlagKey.TYPE_REFERENCE);
          fillList(node.getArguments(), aci.rawArguments());
          set(node, aci);
          setConversionPositionInfo(aci, "this", getPosition(sel));
          return;
        }
       
        if ("super".equals(name)) {
          SuperConstructorInvocation sci = new SuperConstructorInvocation();
          fillList(node.getTypeArguments(), sci.rawConstructorTypeArguments(), FlagKey.TYPE_REFERENCE);
          fillList(node.getArguments(), sci.rawArguments());
          set(node, sci);
          setConversionPositionInfo(sci, "super", getPosition(sel));
          return;
        }
       
        setPos(sel, id.astValue(name));
        sel = null;
      } else if (sel instanceof JCFieldAccess) {
        String name = ((JCFieldAccess) sel).getIdentifier().toString();
        if ("super".equals(name)) {
          SuperConstructorInvocation sci = new SuperConstructorInvocation();
          fillList(node.getTypeArguments(), sci.rawConstructorTypeArguments(), FlagKey.TYPE_REFERENCE);
          fillList(node.getArguments(), sci.rawArguments());
          sci.rawQualifier(toTree(((JCFieldAccess) sel).getExpression()));
          set(node, sci);
          setConversionPositionInfo(sci, "super", getPosition(sel));
          return;
        }
        setPos(sel, id.astValue(name));
        sel = ((JCFieldAccess) sel).getExpression();
      }
      inv.astName(id).rawOperand(toTree(sel));
      fillList(node.getTypeArguments(), inv.rawMethodTypeArguments(), FlagKey.TYPE_REFERENCE);
      fillList(node.getArguments(), inv.rawArguments());
View Full Code Here

TOP

Related Classes of lombok.ast.Identifier

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.