Examples of VariableDeclaration


Examples of com.bacoder.parser.java.api.VariableDeclaration

    super(adapters);
  }

  @Override
  public VariableDeclaration adapt(ConstantDeclaratorContext context) {
    VariableDeclaration variableDeclarator = createNode(context);

    TerminalNode identifierNode = getTerminalNode(context, JavaParser.Identifier);
    if (identifierNode != null) {
      variableDeclarator.setName(getAdapter(IdentifierAdapter.class).adapt(identifierNode));
    }

    variableDeclarator.setDimensions(getAdapter(ArrayDimensionsAdapter.class).adapt(context));

    VariableInitializerContext variableInitializerContext =
        getChild(context, VariableInitializerContext.class);
    if (variableInitializerContext != null) {
      variableDeclarator.setInitializer(
          getAdapter(VariableInitializerAdapter.class).adapt(variableInitializerContext));
    }

    return variableDeclarator;
  }
View Full Code Here

Examples of com.bacoder.parser.java.api.VariableDeclaration

    super(adapters);
  }

  @Override
  public VariableDeclaration adapt(VariableDeclaratorContext context) {
    VariableDeclaration variableDeclarator = createNode(context);

    VariableDeclaratorIdContext variableDeclaratorIdContext =
        getChild(context, VariableDeclaratorIdContext.class);
    if (variableDeclaratorIdContext != null) {
      TerminalNode identifierNode =
          getTerminalNode(variableDeclaratorIdContext, JavaParser.Identifier);
      if (identifierNode != null) {
        variableDeclarator.setName(getAdapter(IdentifierAdapter.class).adapt(identifierNode));
      }

      variableDeclarator.setDimensions(
          getAdapter(ArrayDimensionsAdapter.class).adapt(variableDeclaratorIdContext));
    }

    VariableInitializerContext variableInitializerContext =
        getChild(context, VariableInitializerContext.class);
    if (variableInitializerContext != null) {
      variableDeclarator.setInitializer(
          getAdapter(VariableInitializerAdapter.class).adapt(variableInitializerContext));
    }

    return variableDeclarator;
  }
View Full Code Here

Examples of com.dragome.compiler.ast.VariableDeclaration

    classUnit.setData(reset());

    List fields= theTypeDecl.getFields();
    for (int i= 0; i < fields.size(); i++)
    {
      VariableDeclaration decl= (VariableDeclaration) fields.get(i);

      if (decl.getLocation() == VariableDeclaration.NON_LOCAL)
      {
        //      if (Modifier.isStatic(decl.getModifiers()))
        //    continue;
        //    indent();
        decl.visit(this);
        //println(",");
      }
    }
    depth--;
    //  String superType= null;
View Full Code Here

Examples of com.github.sommeri.less4j.core.ast.VariableDeclaration

  private void handleCommaSplitMixinReferenceArguments(HiddenTokenAwareTree token, MixinReference reference) {
    List<HiddenTokenAwareTree> children = token.getChildren();
    for (HiddenTokenAwareTree kid : children) {
      ASTCssNode parameter = parentBuilder.switchOn(kid);
      if (parameter.getType() == ASTCssNodeType.VARIABLE_DECLARATION) {
        VariableDeclaration variableDeclaration = (VariableDeclaration) parameter;
        Iterator<Expression> expressions = variableDeclaration.getValue().splitByComma().iterator();
       
        variableDeclaration.setValue(expressions.next());
        reference.addNamedParameter(variableDeclaration);
       
        addAsPositional(reference, expressions);
      } else {
        Iterator<Expression> expressions = ((Expression) parameter).splitByComma().iterator();
View Full Code Here

Examples of com.google.dart.engine.ast.VariableDeclaration

  public void computeValues() {
    variableDeclarationMap = constantFinder.getVariableMap();
    constructorDeclarationMap = constantFinder.getConstructorMap();
    constructorInvocations = constantFinder.getConstructorInvocations();
    for (Map.Entry<VariableElement, VariableDeclaration> entry : variableDeclarationMap.entrySet()) {
      VariableDeclaration declaration = entry.getValue();
      ReferenceFinder referenceFinder = new ReferenceFinder(
          declaration,
          referenceGraph,
          variableDeclarationMap,
          constructorDeclarationMap);
      referenceGraph.addNode(declaration);
      declaration.getInitializer().accept(referenceFinder);
    }
    for (Entry<ConstructorElement, ConstructorDeclaration> entry : constructorDeclarationMap.entrySet()) {
      ConstructorDeclaration declaration = entry.getValue();
      ReferenceFinder referenceFinder = new ReferenceFinder(
          declaration,
          referenceGraph,
          variableDeclarationMap,
          constructorDeclarationMap);
      referenceGraph.addNode(declaration);
      boolean superInvocationFound = false;
      NodeList<ConstructorInitializer> initializers = declaration.getInitializers();
      for (ConstructorInitializer initializer : initializers) {
        if (initializer instanceof SuperConstructorInvocation) {
          superInvocationFound = true;
        }
        initializer.accept(referenceFinder);
      }
      if (!superInvocationFound) {
        // No explicit superconstructor invocation found, so we need to manually insert
        // a reference to the implicit superconstructor.
        InterfaceType superclass = ((InterfaceType) entry.getKey().getReturnType()).getSuperclass();
        if (superclass != null && !superclass.isObject()) {
          ConstructorElement unnamedConstructor = superclass.getElement().getUnnamedConstructor();
          ConstructorDeclaration superConstructorDeclaration = findConstructorDeclaration(unnamedConstructor);
          if (superConstructorDeclaration != null) {
            referenceGraph.addEdge(declaration, superConstructorDeclaration);
          }
        }
      }
      for (FormalParameter parameter : declaration.getParameters().getParameters()) {
        referenceGraph.addNode(parameter);
        referenceGraph.addEdge(declaration, parameter);
        if (parameter instanceof DefaultFormalParameter) {
          Expression defaultValue = ((DefaultFormalParameter) parameter).getDefaultValue();
          if (defaultValue != null) {
View Full Code Here

Examples of com.google.dart.engine.ast.VariableDeclaration

   * @param constNode the constant for which a value is to be computed
   */
  private void computeValueFor(AstNode constNode) {
    beforeComputeValue(constNode);
    if (constNode instanceof VariableDeclaration) {
      VariableDeclaration declaration = (VariableDeclaration) constNode;
      Element element = declaration.getElement();
      EvaluationResultImpl result = declaration.getInitializer().accept(createConstantVisitor());
      ((VariableElementImpl) element).setEvaluationResult(result);
    } else if (constNode instanceof InstanceCreationExpression) {
      InstanceCreationExpression expression = (InstanceCreationExpression) constNode;
      ConstructorElement constructor = expression.getStaticElement();
      if (constructor == null) {
        // Couldn't resolve the constructor so we can't compute a value.  No problem--the error
        // has already been reported.
        return;
      }
      ConstantVisitor constantVisitor = createConstantVisitor();
      EvaluationResultImpl result = evaluateConstructorCall(
          constNode,
          expression.getArgumentList().getArguments(),
          constructor,
          constantVisitor);
      expression.setEvaluationResult(result);
    } else if (constNode instanceof ConstructorDeclaration) {
      ConstructorDeclaration declaration = (ConstructorDeclaration) constNode;
      NodeList<ConstructorInitializer> initializers = declaration.getInitializers();
      ConstructorElementImpl constructor = (ConstructorElementImpl) declaration.getElement();
      constructor.setConstantInitializers(new InitializerCloner().cloneNodeList(initializers));
    } else if (constNode instanceof FormalParameter) {
      if (constNode instanceof DefaultFormalParameter) {
        DefaultFormalParameter parameter = ((DefaultFormalParameter) constNode);
        ParameterElement element = parameter.getElement();
View Full Code Here

Examples of com.google.dart.engine.ast.VariableDeclaration

      element = ((PropertyAccessorElement) element).getVariable();
    }
    if (element instanceof VariableElement) {
      VariableElement variable = (VariableElement) element;
      if (variable.isConst()) {
        VariableDeclaration variableDeclaration = variableDeclarationMap.get(variable);
        // The declaration will be null when the variable is not defined in the compilation units
        // that were used to produce the variableDeclarationMap.  In such cases, the variable should
        // already have a value associated with it, but we don't bother to check because there's
        // nothing we can do about it at this point.
        if (variableDeclaration != null) {
View Full Code Here

Examples of com.google.minijoe.compiler.ast.VariableDeclaration

    if (nextToken == Token.OPERATOR_ASSIGNMENT) {
      readToken(Token.OPERATOR_ASSIGNMENT);
      initializer = parseAssignmentExpression(inFlag);
    }

    return new VariableDeclaration(identifier, initializer);
  }
View Full Code Here

Examples of com.google.test.metric.cpp.dom.VariableDeclaration

  public void idExpression(String text) {
  }

  @Override
  public void directDeclarator(String id) {
    node = new VariableDeclaration(type, id, pointer);
    parent.addChild(node);
    pointer = false;
  }
View Full Code Here

Examples of com.google.test.metric.cpp.dom.VariableDeclaration

    public void visit(AssignmentExpression assignmentExpression) {
      Node leftSide = assignmentExpression.getExpression(0);
      Node rightSide = assignmentExpression.getExpression(1);
      Variable leftVar = null;
      Variable rightVar = null;
      VariableDeclaration leftDeclaration = null;
      if (leftSide instanceof Name) {
        Name leftName = (Name) leftSide;
        leftDeclaration = leftName.lookupVariable(leftName.getIdentifier());
        leftVar = new Variable(leftDeclaration.getName(),
            CppType.fromName(leftDeclaration.getType()), false, false);
      }
      if (rightSide instanceof Name) {
        Name rightName = (Name) rightSide;
        VariableDeclaration declaration = rightName.lookupVariable(
            rightName.getIdentifier());
        rightVar = new Variable(declaration.getName(),
            CppType.fromName(declaration.getType()), false, false);
      }
      if (leftVar != null && rightVar != null) {
        Node leftParent = leftDeclaration.getParent();
        if (leftParent instanceof ClassDeclaration) {
          ClassInfo classInfo = repository.getClass(leftDeclaration.getName());
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.