Examples of LocalVariable


Examples of org.cojen.classfile.LocalVariable

        mCleanEntries = new ArrayList<Entry>(size);
        mRangeCount = 0;

        outer: for (int i=0; i<size; i++) {
            Entry entry = mEntries.get(i);
            LocalVariable localVar = entry.mLocalVar;

            Set<LocationRange> ranges = localVar.getLocationRangeSet();
            if (ranges == null || ranges.size() == 0) {
                continue;
            }

            for (LocationRange range : ranges) {
View Full Code Here

Examples of org.cojen.classfile.LocalVariable

        }

        mi.markSynthetic();
        CodeBuilder b = new CodeBuilder(mi);

        LocalVariable beanVar, propertyVar, valueVar;

        switch (methodType) {
        case READ_METHOD: case TRY_READ_METHOD: default:
            beanVar = b.getParameter(0);
            propertyVar = b.getParameter(1);
View Full Code Here

Examples of org.cojen.classfile.LocalVariable

        }

        mi.markSynthetic();
        CodeBuilder b = new CodeBuilder(mi);

        LocalVariable beanVar = b.getParameter(0);
        b.loadLocal(beanVar);
        b.checkCast(TypeDesc.forClass(beanType));
        b.storeLocal(beanVar);

        LocalVariable valueVar = b.getParameter(1);

        // If search value is null, only check properties which might be null.
        b.loadLocal(valueVar);
        Label searchNotNull = b.createLabel();
        b.ifNullBranch(searchNotNull, false);
View Full Code Here

Examples of org.cojen.classfile.LocalVariable

            List subNodes = node.mSubNodes;

            mBuilder.mapLineNumber(++mReferenceLine);

            if (c == '*') {
                LocalVariable savedIndex;
               
                if (mTempLocals.isEmpty()) {
                    savedIndex =
                        mBuilder.createLocalVariable("temp", mIntType);
                } else {
View Full Code Here

Examples of org.cojen.classfile.LocalVariable

            if (node == null) {
                mBuilder.loadConstant('\uffff');
                mBuilder.ifComparisonBranch(loopEnd, "==");
            } else {
                LocalVariable tempChar;
                if (mTempLocals.isEmpty()) {
                    tempChar =
                        mBuilder.createLocalVariable("temp", mIntType);
                } else {
                    tempChar = (LocalVariable)mTempLocals.pop();
View Full Code Here

Examples of org.cojen.classfile.LocalVariable

        MethodInfo mi = cf.addMethod(compareMethod);
        mi.markSynthetic();
        builder = new CodeBuilder(mi);

        Label endLabel = builder.createLabel();
        LocalVariable obj1 = builder.getParameter(0);
        LocalVariable obj2 = builder.getParameter(1);

        // The first rule always applies to the beans directly. All others
        // apply to properties.

        BeanComparator[] ruleParts = rules.getRuleParts();
        BeanComparator bc = ruleParts[0];

        if ((bc.mFlags & 0x01) != 0) {
            // Reverse beans.
            LocalVariable temp = obj1;
            obj1 = obj2;
            obj2 = temp;
        }

        // Handle the case when obj1 and obj2 are the same (or both null)
        builder.loadLocal(obj1);
        builder.loadLocal(obj2);
        builder.ifEqualBranch(endLabel, true);

        // Do null order checks for beans.
        boolean nullHigh = (bc.mFlags & 0x02) == 0;
        Label label = builder.createLabel();
        builder.loadLocal(obj1);
        builder.ifNullBranch(label, false);
        builder.loadConstant(nullHigh ? 1 : -1);
        builder.returnValue(TypeDesc.INT);
        label.setLocation();
        label = builder.createLabel();
        builder.loadLocal(obj2);
        builder.ifNullBranch(label, false);
        builder.loadConstant(nullHigh ? -1 : 1);
        builder.returnValue(TypeDesc.INT);
        label.setLocation();

        // Call 'using' Comparator if one is provided.
        LocalVariable result =
            builder.createLocalVariable("result", TypeDesc.INT);
        if (bc.mUsingComparator != null) {
            builder.loadThis();
            builder.loadField("mUsingComparators", comparatorArrayType);
            builder.loadConstant(0);
            builder.loadFromArray(TypeDesc.forClass(Comparator.class));
            builder.loadLocal(obj1);
            builder.loadLocal(obj2);
            builder.invoke(compareMethod);
            builder.storeLocal(result);
            builder.loadLocal(result);
            label = builder.createLabel();
            builder.ifZeroComparisonBranch(label, "==");
            builder.loadLocal(result);
            builder.returnValue(TypeDesc.INT);
            label.setLocation();
        }

        // Cast bean parameters to correct types so that properties may be
        // accessed.
        TypeDesc type = TypeDesc.forClass(bc.mBeanClass);
        builder.loadLocal(obj1);
        builder.checkCast(type);
        builder.storeLocal(obj1);
        builder.loadLocal(obj2);
        builder.checkCast(type);
        builder.storeLocal(obj2);

        // Generate code to perform comparisons against each property.
        for (int i=1; i<ruleParts.length; i++) {
            bc = ruleParts[i];

            BeanProperty prop =
                (BeanProperty)bc.getProperties().get(bc.mOrderByName);
            Class propertyClass = prop.getType();
            TypeDesc propertyType = TypeDesc.forClass(propertyClass);

            // Create local variable to hold property values.
            LocalVariable p1 = builder.createLocalVariable("p1", propertyType);
            LocalVariable p2 = builder.createLocalVariable("p2", propertyType);

            // Access properties and store in local variables.
            builder.loadLocal(obj1);
            builder.invoke(prop.getReadMethod());
            builder.storeLocal(p1);
            builder.loadLocal(obj2);
            builder.invoke(prop.getReadMethod());
            builder.storeLocal(p2);

            if ((bc.mFlags & 0x01) != 0) {
                // Reverse properties.
                LocalVariable temp = p1;
                p1 = p2;
                p2 = temp;
            }

            Label nextLabel = builder.createLabel();
View Full Code Here

Examples of org.eclipse.jdt.internal.core.LocalVariable

      JavaElement type = this.getJavaElementOfCompilationUnit(typeDeclaration, typeDeclaration.binding);
      parent = Util.getUnresolvedJavaElement(local.sourceStart, local.sourceEnd, type);
    }
    if (parent == null) return null;

    return new LocalVariable(
        parent,
        new String(local.name),
        local.declarationSourceStart,
        local.declarationSourceEnd,
        local.sourceStart,
View Full Code Here

Examples of org.eclipse.jdt.internal.core.LocalVariable

            maskedLimitTo,
            matchRule);
      }
      break;
    case IJavaElement.LOCAL_VARIABLE :
      LocalVariable localVar = (LocalVariable) element;
      searchPattern = new LocalVariablePattern(localVar, limitTo, matchRule);
      break;
    case IJavaElement.TYPE_PARAMETER:
      ITypeParameter typeParam = (ITypeParameter) element;
      boolean findParamDeclarations = true;
View Full Code Here

Examples of org.eclipse.jdt.internal.core.LocalVariable

*/
protected IJavaElement createHandle(AbstractVariableDeclaration variableDeclaration, IJavaElement parent) {
  switch (variableDeclaration.getKind()) {
    case AbstractVariableDeclaration.LOCAL_VARIABLE:
      if (variableDeclaration.type.resolvedType != null) {
        return new LocalVariable((JavaElement)parent,
          new String(variableDeclaration.name),
          variableDeclaration.declarationSourceStart,
          variableDeclaration.declarationSourceEnd,
          variableDeclaration.sourceStart,
          variableDeclaration.sourceEnd,
          new String(variableDeclaration.type.resolvedType.signature()),
          variableDeclaration.annotations,
          variableDeclaration.modifiers,
          false
        );
      }
      break;
    case AbstractVariableDeclaration.PARAMETER:
      if (variableDeclaration.type.resolvedType != null) {
        return new LocalVariable((JavaElement)parent,
          new String(variableDeclaration.name),
          variableDeclaration.declarationSourceStart,
          variableDeclaration.declarationSourceEnd,
          variableDeclaration.sourceStart,
          variableDeclaration.sourceEnd,
View Full Code Here

Examples of org.eclipse.jdt.internal.core.LocalVariable

      }
    } else {
      parent = (JavaElement) declaringMethod.getJavaElement();
    }
    if (parent == null) return null;
    return new LocalVariable(
        parent,
        localVar.getName().getIdentifier(),
        sourceStart,
        sourceEnd,
        nameStart,
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.