Package com.google.dart.engine.internal.element

Examples of com.google.dart.engine.internal.element.LabelElementImpl


  @Override
  public Void visitLabeledStatement(LabeledStatement node) {
    boolean onSwitchStatement = node.getStatement() instanceof SwitchStatement;
    for (Label label : node.getLabels()) {
      SimpleIdentifier labelName = label.getLabel();
      LabelElementImpl element = new LabelElementImpl(labelName, onSwitchStatement, false);

      currentHolder.addLabel(element);
      labelName.setStaticElement(element);
    }
    return super.visitLabeledStatement(node);
View Full Code Here


  @Override
  public Void visitSwitchCase(SwitchCase node) {
    for (Label label : node.getLabels()) {
      SimpleIdentifier labelName = label.getLabel();
      LabelElementImpl element = new LabelElementImpl(labelName, false, true);

      currentHolder.addLabel(element);
      labelName.setStaticElement(element);
    }
    return super.visitSwitchCase(node);
View Full Code Here

  @Override
  public Void visitSwitchDefault(SwitchDefault node) {
    for (Label label : node.getLabels()) {
      SimpleIdentifier labelName = label.getLabel();
      LabelElementImpl element = new LabelElementImpl(labelName, false, true);

      currentHolder.addLabel(element);
      labelName.setStaticElement(element);
    }
    return super.visitSwitchDefault(node);
View Full Code Here

   * @param onSwitchStatement {@code true} if this label is associated with a {@code switch}
   *          statement
   * @param onSwitchMember {@code true} if this label is associated with a {@code switch} member
   */
  public LabelScope(LabelScope outerScope, boolean onSwitchStatement, boolean onSwitchMember) {
    this(outerScope, EMPTY_LABEL, new LabelElementImpl(
        EMPTY_LABEL_IDENTIFIER,
        onSwitchStatement,
        onSwitchMember));
  }
View Full Code Here

   * @param labelNode the node representing the label being looked up
   * @return the element corresponding to the given label node in the current scope
   */
  private LabelElementImpl lookupLabel(AstNode parentNode, SimpleIdentifier labelNode) {
    LabelScope labelScope = resolver.getLabelScope();
    LabelElementImpl labelElement = null;
    if (labelNode == null) {
      if (labelScope == null) {
        // TODO(brianwilkerson) Do we need to report this error, or is this condition always caught in the parser?
        // reportError(ResolverErrorCode.BREAK_OUTSIDE_LOOP);
      } else {
        labelElement = (LabelElementImpl) labelScope.lookup(LabelScope.EMPTY_LABEL);
        if (labelElement == null) {
          // TODO(brianwilkerson) Do we need to report this error, or is this condition always caught in the parser?
          // reportError(ResolverErrorCode.BREAK_OUTSIDE_LOOP);
        }
        //
        // The label element that was returned was a marker for look-up and isn't stored in the
        // element model.
        //
        labelElement = null;
      }
    } else {
      if (labelScope == null) {
        resolver.reportErrorForNode(
            CompileTimeErrorCode.LABEL_UNDEFINED,
            labelNode,
            labelNode.getName());
      } else {
        labelElement = (LabelElementImpl) labelScope.lookup(labelNode.getName());
        if (labelElement == null) {
          resolver.reportErrorForNode(
              CompileTimeErrorCode.LABEL_UNDEFINED,
              labelNode,
              labelNode.getName());
        } else {
          labelNode.setStaticElement(labelElement);
        }
      }
    }
    if (labelElement != null) {
      ExecutableElement labelContainer = labelElement.getAncestor(ExecutableElement.class);
      if (labelContainer != resolver.getEnclosingFunction()) {
        resolver.reportErrorForNode(
            CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE,
            labelNode,
            labelNode.getName());
View Full Code Here

TOP

Related Classes of com.google.dart.engine.internal.element.LabelElementImpl

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.