Package com.google.dart.engine.ast

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


  @Override
  public Void visitDefaultFormalParameter(DefaultFormalParameter node) {
    ElementHolder holder = new ElementHolder();

    NormalFormalParameter normalParameter = node.getParameter();
    SimpleIdentifier parameterName = normalParameter.getIdentifier();
    ParameterElementImpl parameter;
    if (normalParameter instanceof FieldFormalParameter) {
      parameter = new DefaultFieldFormalParameterElementImpl(parameterName);
      FieldElement field = fieldMap == null ? null : fieldMap.get(parameterName.getName());
      if (field != null) {
        ((DefaultFieldFormalParameterElementImpl) parameter).setField(field);
      }
    } else {
      parameter = new DefaultParameterElementImpl(parameterName);
    }
    parameter.setConst(node.isConst());
    parameter.setFinal(node.isFinal());
    parameter.setParameterKind(node.getKind());

    // set initializer, default value range
    Expression defaultValue = node.getDefaultValue();
    if (defaultValue != null) {
      visit(holder, defaultValue);

      FunctionElementImpl initializer = new FunctionElementImpl(
          defaultValue.getBeginToken().getOffset());
      initializer.setFunctions(holder.getFunctions());
      initializer.setLabels(holder.getLabels());
      initializer.setLocalVariables(holder.getLocalVariables());
      initializer.setParameters(holder.getParameters());
      initializer.setSynthetic(true);

      parameter.setInitializer(initializer);
      parameter.setDefaultValueCode(defaultValue.toSource());
    }

    // visible range
    setParameterVisibleRange(node, parameter);

    currentHolder.addParameter(parameter);
    parameterName.setStaticElement(parameter);
    normalParameter.accept(this);
    holder.validate();
    return null;
  }
View Full Code Here

TOP

Related Classes of com.google.dart.engine.ast.NormalFormalParameter

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.