You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2011/04/14 00:23:58 UTC
svn commit: r1091957 -
/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java
Author: hlship
Date: Wed Apr 13 22:23:58 2011
New Revision: 1091957
URL: http://svn.apache.org/viewvc?rev=1091957&view=rev
Log:
TAP5-853: Re-implement support for not operators in sub expressions
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java?rev=1091957&r1=1091956&r2=1091957&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java Wed Apr 13 22:23:58 2011
@@ -778,19 +778,13 @@ public class PropertyConduitSourceImpl i
{
public void doBuild(InstructionBuilder builder)
{
- Class expressionType = buildSubexpression(builder, null, node.getChild(0));
+ Class expressionType = buildPlasticNotExpression(builder, node);
- boxIfPrimitive(builder, expressionType);
-
- // Now invoke the delegate invert() method
-
- builder.loadThis().getField(delegateField);
-
- builder.swap().invoke(DelegateMethods.INVERT);
+ // Yes, we know this will always be the case, for now.
- // When the dust settles, may change invert() to return Boolean, not boolean
+ boxIfPrimitive(builder, expressionType);
- builder.boxPrimitive("boolean").returnResult();
+ builder.returnResult();
}
});
}
@@ -875,9 +869,13 @@ public class PropertyConduitSourceImpl i
return createPlasticListConstructor(builder, node);
+ case NOT:
+
+ return buildPlasticNotExpression(builder, node);
+
default:
throw unexpectedNodeType(node, TRUE, FALSE, INTEGER, DECIMAL, STRING, DEREF, SAFEDEREF,
- IDENTIFIER, INVOKE, LIST);
+ IDENTIFIER, INVOKE, LIST, NOT);
}
}
@@ -1873,6 +1871,21 @@ public class PropertyConduitSourceImpl i
if (termType.isPrimitive())
builder.boxPrimitive(termType.getName());
}
+
+ public Class buildPlasticNotExpression(InstructionBuilder builder, final Tree notNode)
+ {
+ Class expressionType = buildSubexpression(builder, null, notNode.getChild(0));
+
+ boxIfPrimitive(builder, expressionType);
+
+ // Now invoke the delegate invert() method
+
+ builder.loadThis().getField(delegateField);
+
+ builder.swap().invoke(DelegateMethods.INVERT);
+
+ return boolean.class;
+ }
}
public PropertyConduitSourceImpl(PropertyAccess access, @ComponentLayer