Package org.eclipse.jdt.internal.compiler.ast

Examples of org.eclipse.jdt.internal.compiler.ast.NameReference


       * Any primitive types, conditionals, strings, arrays and name references
       * to constant fields will have all been handled by the constant
       * expression block above. This name reference can only be for an
       * enumerated type.
       */
      NameReference nameRef = (NameReference) elementValueExpression;

      assert (nameRef.constant == null || nameRef.constant == Constant.NotAConstant);
      assert (nameRef.actualReceiverType.isEnum());

      Class<?> clazz = getClassLiteral(logger, nameRef.actualReceiverType);
      Class<? extends Enum> enumClass = clazz.asSubclass(Enum.class);

      String enumName = String.valueOf(nameRef.fieldBinding().name);
      elementValue = Enum.valueOf(enumClass, enumName);
    } else if (elementValueExpression instanceof Annotation) {
      elementValue = createAnnotationInstance(logger, elementValueExpression);
    } else {
      assert (false);
View Full Code Here


       * Any primitive types, conditionals, strings, arrays and name references
       * to constant fields will have all been handled by the constant
       * expression block above. This name reference can only be for an
       * enumerated type.
       */
      NameReference nameRef = (NameReference) elementValueExpression;

      assert (nameRef.constant == null || nameRef.constant == Constant.NotAConstant);
      assert (nameRef.actualReceiverType.isEnum());

      Class<?> clazz = getClassLiteral(logger, nameRef.actualReceiverType);
      Class<? extends Enum> enumClass = clazz.asSubclass(Enum.class);

      String enumName = String.valueOf(nameRef.fieldBinding().name);
      elementValue = Enum.valueOf(enumClass, enumName);
    } else if (elementValueExpression instanceof Annotation) {
      elementValue = createAnnotationInstance(logger, elementValueExpression);
    } else {
      assert (false);
View Full Code Here

       * Any primitive types, conditionals, strings, arrays and name references
       * to constant fields will have all been handled by the constant
       * expression block above. This name reference can only be for an
       * enumerated type.
       */
      NameReference nameRef = (NameReference) elementValueExpression;

      assert (nameRef.constant == null || nameRef.constant == Constant.NotAConstant);
      assert (nameRef.actualReceiverType.isEnum());

      Class<?> clazz = getClassLiteral(logger, nameRef.actualReceiverType);
      Class<? extends Enum> enumClass = clazz.asSubclass(Enum.class);

      String enumName = String.valueOf(nameRef.fieldBinding().name);
      elementValue = Enum.valueOf(enumClass, enumName);
    } else if (elementValueExpression instanceof Annotation) {
      elementValue = createAnnotationInstance(logger, elementValueExpression);
    } else {
      assert (false);
View Full Code Here

        } else if (constantExpression instanceof JLiteral) {
          caseLiteral = (JLiteral) constantExpression;
        } else {
          // Adapted from CaseStatement.resolveCase().
          assert x.constantExpression.resolvedType.isEnum();
          NameReference reference = (NameReference) x.constantExpression;
          FieldBinding field = reference.fieldBinding();
          caseLiteral = JIntLiteral.get(field.original().id);
        }
        push(new JCaseStatement(info, caseLiteral));
      } catch (Throwable e) {
        throw translateException(x, e);
View Full Code Here

      }
      this.scribe.printNextToken(TerminalTokens.TokenNameIdentifier, false);
    } else {
      if (argument.isReceiver()) {
        this.scribe.space();
        NameReference qualifyingName = ((Receiver) argument).qualifyingName;
        if (qualifyingName != null) {
          qualifyingName.traverse(this, scope);
          this.scribe.printNextToken(TerminalTokens.TokenNameDOT, false);
        }
        this.scribe.printNextToken(TerminalTokens.TokenNamethis, false);
      } else {
        /*
 
View Full Code Here

        } else if (constantExpression instanceof JLiteral) {
          caseLiteral = (JLiteral) constantExpression;
        } else {
          // Adapted from CaseStatement.resolveCase().
          assert x.constantExpression.resolvedType.isEnum();
          NameReference reference = (NameReference) x.constantExpression;
          FieldBinding field = reference.fieldBinding();
          caseLiteral = JIntLiteral.get(field.original().id);
        }
        push(new JCaseStatement(info, caseLiteral));
      } catch (Throwable e) {
        throw translateException(x, e);
View Full Code Here

    positions,
    0,
    length);

  /* build specific completion on name reference */
  NameReference reference;
  if (completionIndex == 0) {
    /* completion inside first identifier */
    reference = createSingleAssistNameReference(assistIdentifier(), positions[0]);
  } else {
    /* completion inside subsequent identifier */
 
View Full Code Here

   ==>
  this.astStack : Argument
  this.identifierStack :
  this.intStack :
  */
  NameReference qualifyingNameReference = null;
    boolean isReceiver = this.intStack[this.intPtr--] == 0// flag pushed in consumeExplicitThisParameter -> 0, consumeVariableDeclaratorIdParameter -> 1
    if (isReceiver) {
      qualifyingNameReference = (NameReference) this.expressionStack[this.expressionPtr--];
      this.expressionLengthPtr --;
    }
View Full Code Here

protected void consumeExplicitThisParameter(boolean isQualified) {
  // VariableDeclaratorIdOrThis ::= 'this'
  // VariableDeclaratorIdOrThis ::= UnannotatableName '.' 'this'
  // VariableDeclaratorIdOrThis ::= VariableDeclaratorId

  NameReference qualifyingNameReference = null;
  if (isQualified) {
    qualifyingNameReference = getUnspecifiedReference(false); // By construction the qualified name is unannotated here, so we should not meddle with the type annotation stack
  }
  pushOnExpressionStack(qualifyingNameReference);
  int thisStart = this.intStack[this.intPtr--];
View Full Code Here

  /* build a (unspecified) NameReference which may be qualified*/
  if (rejectTypeAnnotations) { // Compensate for overpermissive grammar.
    consumeNonTypeUseName();
  }
  int length;
  NameReference ref;
  if ((length = this.identifierLengthStack[this.identifierLengthPtr--]) == 1)
    // single variable reference
    ref =
      new SingleNameReference(
        this.identifierStack[this.identifierPtr],
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.ast.NameReference

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.