Package org.eclipse.jdt.internal.compiler.lookup

Examples of org.eclipse.jdt.internal.compiler.lookup.FieldBinding.constant()


    switch (this.bits & RestrictiveFlagMASK) {
      case Binding.FIELD : // reading a field
        if (!valueRequired)
          break;
        FieldBinding codegenField = ((FieldBinding) this.binding).original();
        Constant fieldConstant = codegenField.constant();
        if (fieldConstant == Constant.NotAConstant) { // directly use inlined value for constant fields
          if (codegenField.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) {
            TypeBinding someReceiverType = this.delegateThis != null ? this.delegateThis.type : this.actualReceiverType;
            TypeBinding constantPoolDeclaringClass = CodeStream.getConstantPoolDeclaringClass(currentScope, codegenField, someReceiverType, true /* implicit this */);
            if (codegenField.isStatic()) {
View Full Code Here


  } else {
    FieldBinding codegenBinding = this.binding.original();
    boolean isStatic = codegenBinding.isStatic();
    this.receiver.generateCode(currentScope, codeStream, !isStatic);
    if (valueRequired) {
      Constant fieldConstant = codegenBinding.constant();
      if (fieldConstant == Constant.NotAConstant) {
        if (codegenBinding.declaringClass == null) { // array length
          codeStream.arraylength();
        } else {
          if (codegenBinding.canBeSeenBy(this.actualReceiverType, this, currentScope)) {
View Full Code Here

    return;
  }
  lastFieldBinding = generateReadSequence(currentScope, codeStream);
  if (lastFieldBinding != null) {
    boolean isStatic = lastFieldBinding.isStatic();
    Constant fieldConstant = lastFieldBinding.constant();
    if (fieldConstant != Constant.NotAConstant) {
      if (!isStatic){
        codeStream.invokeObjectGetClass();
        codeStream.pop();
      }
View Full Code Here

    case Binding.FIELD :
      lastFieldBinding = ((FieldBinding) this.binding).original();
      lastGenericCast = this.genericCast;
      lastReceiverType = this.actualReceiverType;
      // if first field is actually constant, we can inline it
      if (lastFieldBinding.constant() != Constant.NotAConstant) {
        break;
      }
      if (needValue) {
        if (lastFieldBinding.canBeSeenBy(this.actualReceiverType, this, currentScope)) {
          if (!lastFieldBinding.isStatic()) {
View Full Code Here

      if (isFieldUseDeprecated(field, scope, index+1 == length ? this.bits : 0)) {
        scope.problemReporter().deprecatedField(field, this);
      }
      // constant propagation can only be performed as long as the previous one is a constant too.
      if (this.constant != Constant.NotAConstant){
        this.constant = field.constant();
      }
      type = field.type;
      index++;
    } else {
      this.constant = Constant.NotAConstant; //don't fill other constants slots...
View Full Code Here

    return;
  }
  FieldBinding codegenBinding = this.binding.original();
  boolean isStatic = codegenBinding.isStatic();
  boolean isThisReceiver = this.receiver instanceof ThisReference;
  Constant fieldConstant = codegenBinding.constant();
  if (fieldConstant != Constant.NotAConstant) {
    if (!isThisReceiver) {
      this.receiver.generateCode(currentScope, codeStream, !isStatic);
      if (!isStatic){
        codeStream.invokeObjectGetClass();
View Full Code Here

  return flowInfo;
}

public TypeBinding checkFieldAccess(BlockScope scope) {
  FieldBinding fieldBinding = (FieldBinding) this.binding;
  this.constant = fieldBinding.constant();

  this.bits &= ~ASTNode.RestrictiveFlagMASK; // clear bits
  this.bits |= Binding.FIELD;
  MethodScope methodScope = scope.methodScope();
  if (fieldBinding.isStatic()) {
View Full Code Here

    return;
  } else {
    switch (this.bits & ASTNode.RestrictiveFlagMASK) {
      case Binding.FIELD : // reading a field
        FieldBinding codegenField = ((FieldBinding) this.binding).original();
        Constant fieldConstant = codegenField.constant();
        if (fieldConstant != Constant.NotAConstant) {
          // directly use inlined value for constant fields
          if (valueRequired) {
            codeStream.generateConstant(fieldConstant, this.implicitConversion);
          }
View Full Code Here

    }
  } else {
    FieldBinding lastFieldBinding = generateReadSequence(currentScope, codeStream);
    if (lastFieldBinding != null) {
      boolean isStatic = lastFieldBinding.isStatic();
      Constant fieldConstant = lastFieldBinding.constant();
      if (fieldConstant != Constant.NotAConstant) {
        if (!isStatic){
          codeStream.invokeObjectGetClass();
          codeStream.pop();
        }
View Full Code Here

    case Binding.FIELD :
      lastFieldBinding = ((FieldBinding) this.binding).original();
      lastGenericCast = this.genericCast;
      lastReceiverType = this.actualReceiverType;
      // if first field is actually constant, we can inline it
      if (lastFieldBinding.constant() != Constant.NotAConstant) {
        break;
      }
      if ((needValue && !lastFieldBinding.isStatic()) || lastGenericCast != null) {
        int pc = codeStream.position;
        if ((this.bits & ASTNode.DepthMASK) != 0) {
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.