Examples of FieldAccess


Examples of org.eclipse.jdt.core.dom.FieldAccess

          node, (ArrayAccess) targetNode,
          source,
          eclipseVariableQuery);
    }
    if(targetNode instanceof FieldAccess) {
      FieldAccess target = (FieldAccess) targetNode;
      return new StoreFieldInstructionImpl(
          node, 
          source,
          new EclipseReferenceFieldAccess(target, eclipseVariableQuery),
          eclipseVariableQuery);
    }
    if(targetNode instanceof SuperFieldAccess) {
      SuperFieldAccess target = (SuperFieldAccess) targetNode;
      return new StoreFieldInstructionImpl(
          node, 
          source,
          new EclipseSuperFieldAccess(target, eclipseVariableQuery),
          eclipseVariableQuery);
    }
    if(targetNode instanceof QualifiedName) {
      QualifiedName target = (QualifiedName) targetNode;
      IBinding binding = target.resolveBinding();
      if(binding instanceof IVariableBinding) {
        IVariableBinding vb = (IVariableBinding) binding;
        if(vb.isField()) {
          return new StoreFieldInstructionImpl(
              node,
              source,
              new EclipseBrokenFieldAccess(target, eclipseVariableQuery),
              eclipseVariableQuery);
        }
      }
    }
    if(targetNode instanceof SimpleName) {
      SimpleName target = (SimpleName) targetNode;
      IBinding binding = target.resolveBinding();
      if(binding instanceof IVariableBinding) {
        IVariableBinding vb = (IVariableBinding) binding;
        if(vb.isField()) {
          // implicit field access on this
          return new StoreFieldInstructionImpl(
View Full Code Here

Examples of org.eclipse.jdt.core.dom.FieldAccess

  @Test
  public void testReadThis() throws Exception {
    CompilationUnit cu = EclipseTACSimpleTestDriver.parseCode("ThisRead", THIS_READ);
    MethodDeclaration m = EclipseTACSimpleTestDriver.getFirstMethod(cu);
    EclipseTAC tac = new EclipseTAC(m.resolveBinding());
    FieldAccess read = (FieldAccess) EclipseTACSimpleTestDriver.getLastStatementReturn(m).getExpression();
    TACInstruction instr = tac.instruction(read);
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof LoadFieldInstruction);
    LoadFieldInstruction load = (LoadFieldInstruction) instr;
    Assert.assertTrue(load.getSourceObject() instanceof ThisVariable);
    Assert.assertTrue(load.getSourceObject().isUnqualifiedThis());
    Assert.assertNull(((ThisVariable) load.getSourceObject()).getQualifier());
    Assert.assertEquals(tac.variable(read.getExpression()), load.getSourceObject());
    Assert.assertEquals("f", load.getFieldName());
  }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.FieldAccess

      this.processExpression(ce.getElseExpression());
      break;
    }

    case ASTNode.FIELD_ACCESS: {
      final FieldAccess fieldAccess = (FieldAccess) node;

      if (fieldAccess.resolveFieldBinding().getJavaElement() == null)
        throw new DefinitelyNotEnumerizableException(
            Messages.ASTNodeProcessor_NonEnumerizableTypeEncountered, node);
      else {
        final IJavaElement elem = fieldAccess.resolveFieldBinding()
            .getJavaElement();
        if (elem.isReadOnly() || fieldAccess.resolveBoxing())
          throw new DefinitelyNotEnumerizableException(
              Messages.ASTNodeProcessor_SourceNotPresent, node);
        if (fieldAccess.resolveTypeBinding().isEqualTo(
            node.getAST().resolveWellKnownType("java.lang.Object"))) //$NON-NLS-1$
          throw new NonEnumerizableASTException(
              Messages.ASTNodeProcessor_IllegalArrayUpcast, fieldAccess);
        this.found.add(elem);
      }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.FieldAccess

          continue;
        }
      }
      // all "dataSource.x = X" fields assignment must be before
      if (parentNode instanceof FieldAccess) {
        FieldAccess fieldAccess = (FieldAccess) parentNode;
        if (isRepresentedBy(fieldAccess.getExpression())
            && fieldAccess.getParent() instanceof Assignment) {
          nodes.add(node);
          continue;
        }
      }
    }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.FieldAccess

          + "Property Lower: " + property.getLower());

      // Left expression
      SimpleName simpleName = ast.newSimpleName(property.getName());
      ThisExpression thisExpression = ast.newThisExpression();
      FieldAccess fieldAccess = ast.newFieldAccess();
      fieldAccess.setName(simpleName);
      fieldAccess.setExpression(thisExpression);

      // Right expression
      SimpleName parameter = ast.newSimpleName(property.getName());

      Assignment assignment = ast.newAssignment();
View Full Code Here

Examples of org.eclipse.php.internal.core.ast.nodes.FieldAccess

    Program program = createAndParse(str);

    ExpressionStatement statement = (ExpressionStatement) program
        .statements().get(3);
    Assignment assignment = (Assignment) statement.getExpression();
    FieldAccess fieldAccess = (FieldAccess) assignment.getRightHandSide();

    IVariableBinding variableBinding = fieldAccess.resolveFieldBinding();

    Assert.assertTrue(variableBinding.isField() == true);
    Assert.assertTrue(variableBinding.getName().equals("$anotherOne"));
    Assert.assertTrue(variableBinding.getKind() == IBinding.VARIABLE);
  }
View Full Code Here

Examples of org.eclipse.php.internal.core.compiler.ast.nodes.FieldAccess

    Expression expression = (Expression) typedGoal.getExpression();

    Expression receiver;
    Expression field;
    if (expression instanceof FieldAccess) {
      FieldAccess fieldAccess = (FieldAccess) expression;
      receiver = fieldAccess.getDispatcher();
      field = fieldAccess.getField();
    } else if (expression instanceof StaticFieldAccess) {
      StaticFieldAccess fieldAccess = (StaticFieldAccess) expression;
      receiver = fieldAccess.getDispatcher();
      field = fieldAccess.getField();
    } else {
      return null;
    }

    String variableName;
View Full Code Here

Examples of org.jboss.aop.joinpoint.FieldAccess

      return null;
   }

   protected AdviceMethodProperties getAdviceMethodProperties(JoinPointBean joinPoint, AdviceSetup setup)
   {
      FieldAccess fieldAccess = (FieldAccess)joinPoint;
      Field field = fieldAccess.getField();
      return new AdviceMethodProperties(
            joinPoint,
            setup.getAspectClass(),
            setup.getAdviceName(),
            JOINPOINT_TYPE,
            (fieldAccess.isRead()) ? READ_INVOCATION_TYPE : WRITE_INVOCATION_TYPE,
            (fieldAccess.isRead()) ? field.getGenericType() : Void.TYPE,
            (fieldAccess.isRead()) ? new Type[] {} : new Type[] {field.getGenericType()},
            (fieldAccess.isRead()) ? new Class[] {} : new Class[] {field.getType()},
             null,
             field.getDeclaringClass(),
             hasTargetObject());
   }
View Full Code Here

Examples of org.jboss.aop.joinpoint.FieldAccess

      assertNull(JoinPointAspect.throwingJoinPoint);
      assertNull(JoinPointAspect.finallyAdvice);
      assertNull(JoinPointAspect.finallyJoinPoint);
     
      assertTrue(JoinPointAspect.afterJoinPoint instanceof FieldAccess);
      FieldAccess fieldAccess = (FieldAccess) JoinPointAspect.afterJoinPoint;
      assertEquals("number", fieldAccess.getField().getName());
      assertFalse(fieldAccess.isRead());
   }
View Full Code Here

Examples of org.jboss.aop.joinpoint.FieldAccess

      assertNotNull(JoinPointAspect.finallyJoinPoint);
     
      assertSame(JoinPointAspect.beforeJoinPoint,
            JoinPointAspect.finallyJoinPoint);
      assertTrue(JoinPointAspect.beforeJoinPoint instanceof FieldAccess);
      FieldAccess fieldAccess = (FieldAccess) JoinPointAspect.beforeJoinPoint;
      assertEquals("text", fieldAccess.getField().getName());
      assertFalse(fieldAccess.isRead());
   }
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.