Examples of LabelScope


Examples of com.google.dart.engine.internal.scope.LabelScope

   * @param parentNode the node containing the given label
   * @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());
View Full Code Here

Examples of com.google.dart.engine.internal.scope.LabelScope

    return null;
  }

  @Override
  public Void visitDoStatement(DoStatement node) {
    LabelScope outerLabelScope = labelScope;
    try {
      labelScope = new LabelScope(labelScope, false, false);
      visitStatementInScope(node.getBody());
      safelyVisit(node.getCondition());
    } finally {
      labelScope = outerLabelScope;
    }
View Full Code Here

Examples of com.google.dart.engine.internal.scope.LabelScope

  }

  @Override
  public Void visitForEachStatement(ForEachStatement node) {
    Scope outerNameScope = nameScope;
    LabelScope outerLabelScope = labelScope;
    try {
      nameScope = new EnclosedScope(nameScope);
      labelScope = new LabelScope(outerLabelScope, false, false);
      visitForEachStatementInScope(node);
    } finally {
      labelScope = outerLabelScope;
      nameScope = outerNameScope;
    }
View Full Code Here

Examples of com.google.dart.engine.internal.scope.LabelScope

  }

  @Override
  public Void visitForStatement(ForStatement node) {
    Scope outerNameScope = nameScope;
    LabelScope outerLabelScope = labelScope;
    try {
      nameScope = new EnclosedScope(nameScope);
      labelScope = new LabelScope(outerLabelScope, false, false);
      visitForStatementInScope(node);
    } finally {
      labelScope = outerLabelScope;
      nameScope = outerNameScope;
    }
View Full Code Here

Examples of com.google.dart.engine.internal.scope.LabelScope

    return null;
  }

  @Override
  public Void visitLabeledStatement(LabeledStatement node) {
    LabelScope outerScope = addScopesFor(node.getLabels());
    try {
      super.visitLabeledStatement(node);
    } finally {
      labelScope = outerScope;
    }
View Full Code Here

Examples of com.google.dart.engine.internal.scope.LabelScope

    return null;
  }

  @Override
  public Void visitSwitchStatement(SwitchStatement node) {
    LabelScope outerScope = labelScope;
    try {
      labelScope = new LabelScope(outerScope, true, false);
      for (SwitchMember member : node.getMembers()) {
        for (Label label : member.getLabels()) {
          SimpleIdentifier labelName = label.getLabel();
          LabelElement labelElement = (LabelElement) labelName.getStaticElement();
          labelScope = new LabelScope(labelScope, labelName.getName(), labelElement);
        }
      }
      super.visitSwitchStatement(node);
    } finally {
      labelScope = outerScope;
View Full Code Here

Examples of com.google.dart.engine.internal.scope.LabelScope

    return null;
  }

  @Override
  public Void visitWhileStatement(WhileStatement node) {
    LabelScope outerScope = labelScope;
    try {
      labelScope = new LabelScope(outerScope, false, false);
      safelyVisit(node.getCondition());
      visitStatementInScope(node.getBody());
    } finally {
      labelScope = outerScope;
    }
View Full Code Here

Examples of com.google.dart.engine.internal.scope.LabelScope

   *
   * @param labels the labels for which new scopes are to be added
   * @return the scope that was in effect before the new scopes were added
   */
  private LabelScope addScopesFor(NodeList<Label> labels) {
    LabelScope outerScope = labelScope;
    for (Label label : labels) {
      SimpleIdentifier labelNameNode = label.getLabel();
      String labelName = labelNameNode.getName();
      LabelElement labelElement = (LabelElement) labelNameNode.getStaticElement();
      labelScope = new LabelScope(labelScope, labelName, labelElement);
    }
    return outerScope;
  }
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.