Пример #1
0
 @Override
 public Void visitConstructorDeclaration(ConstructorDeclaration node) {
   visit(node.getExternalKeyword(), " ");
   visit(node.getConstKeyword(), " ");
   visit(node.getFactoryKeyword(), " ");
   visit(node.getReturnType());
   visit(".", node.getName());
   visit(node.getParameters());
   visitList(" : ", node.getInitializers(), ", ");
   visit(" = ", node.getRedirectedConstructor());
   visit(" ", node.getBody());
   return null;
 }
Пример #2
0
  @Override
  public Void visitConstructorDeclaration(ConstructorDeclaration node) {
    ElementHolder holder = new ElementHolder();
    visitChildren(holder, node);

    SimpleIdentifier constructorName = node.getName();
    ConstructorElementImpl element = new ConstructorElementImpl(constructorName);
    if (node.getFactoryKeyword() != null) {
      element.setFactory(true);
    }
    element.setFunctions(holder.getFunctions());
    element.setLabels(holder.getLabels());
    element.setLocalVariables(holder.getVariables());
    element.setParameters(holder.getParameters());

    currentHolder.addConstructor(element);
    node.setElement(element);
    if (constructorName != null) {
      constructorName.setElement(element);
    }
    return null;
  }
Пример #3
0
  @Override
  public Void visitConstructorDeclaration(ConstructorDeclaration node) {
    isValidMixin = false;
    ElementHolder holder = new ElementHolder();
    boolean wasInFunction = inFunction;
    inFunction = true;
    try {
      visitChildren(holder, node);
    } finally {
      inFunction = wasInFunction;
    }

    SimpleIdentifier constructorName = node.getName();
    ConstructorElementImpl element = new ConstructorElementImpl(constructorName);
    if (node.getFactoryKeyword() != null) {
      element.setFactory(true);
    }
    element.setFunctions(holder.getFunctions());
    element.setLabels(holder.getLabels());
    element.setLocalVariables(holder.getLocalVariables());
    element.setParameters(holder.getParameters());
    element.setConst(node.getConstKeyword() != null);

    currentHolder.addConstructor(element);
    node.setElement(element);
    if (constructorName == null) {
      Identifier returnType = node.getReturnType();
      if (returnType != null) {
        element.setNameOffset(returnType.getOffset());
      }
    } else {
      constructorName.setStaticElement(element);
    }
    holder.validate();
    return null;
  }