@@ -85,7 +85,7 @@ public final CompiledBlockVisitor visit() {
8585 final int c = compiledData [positionAtCompiledBlock .getAndIncrement ()] & 0xFF ;
8686 final boolean wideCode = (c & JBBPCompiler .FLAG_WIDE ) != 0 ;
8787 final int ec = wideCode ? compiledData [positionAtCompiledBlock .getAndIncrement ()] & 0xFF : 0 ;
88- final boolean isFloatDoubleOrStringField = (ec & JBBPCompiler .EXT_FLAG_EXTRA_DIFF_TYPE ) != 0 ;
88+ final boolean altFileType = (ec & JBBPCompiler .EXT_FLAG_EXTRA_DIFF_TYPE ) != 0 ;
8989 final boolean extraFieldNumAsExpr = (ec & JBBPCompiler .EXT_FLAG_EXTRA_AS_EXPRESSION ) != 0 ;
9090 final int code = (ec << 8 ) | c ;
9191
@@ -134,7 +134,15 @@ public final CompiledBlockVisitor visit() {
134134 case JBBPCompiler .CODE_SKIP :
135135 case JBBPCompiler .CODE_ALIGN : {
136136 final JBBPIntegerValueEvaluator evaluator = extraFieldNumAsExpr ? extraFieldValueEvaluator : new IntConstValueEvaluator (JBBPUtils .unpackInt (compiledData , positionAtCompiledBlock ));
137- visitActionItem (theOffset , theCode , evaluator );
137+ if (altFileType ) {
138+ if (theCode == JBBPCompiler .CODE_SKIP ) {
139+ visitValField (theOffset , name , evaluator );
140+ } else {
141+ throw new Error ("Unexpected code:" + theCode );
142+ }
143+ } else {
144+ visitActionItem (theOffset , theCode , evaluator );
145+ }
138146 }
139147 break ;
140148
@@ -151,7 +159,7 @@ public final CompiledBlockVisitor visit() {
151159 case JBBPCompiler .CODE_USHORT :
152160 case JBBPCompiler .CODE_INT :
153161 case JBBPCompiler .CODE_LONG : {
154- visitPrimitiveField (theOffset , theCode , name , byteOrder , readWholeStream , isFloatDoubleOrStringField , arraySizeEvaluator );
162+ visitPrimitiveField (theOffset , theCode , name , byteOrder , readWholeStream , altFileType , arraySizeEvaluator );
155163 }
156164 break ;
157165
@@ -201,6 +209,17 @@ public final CompiledBlockVisitor visit() {
201209 public void visitActionItem (int offsetInCompiledBlock , int actionType , JBBPIntegerValueEvaluator nullableArgument ) {
202210 }
203211
212+ /**
213+ * Visit field contains virtual field with VAL type.
214+ *
215+ * @param offsetInCompiledBlock offset in the compiled block
216+ * @param nameFieldInfo name of the field, must not be null
217+ * @param expression expression to calculate value
218+ * @since 1.4.0
219+ */
220+ public void visitValField (int offsetInCompiledBlock , JBBPNamedFieldInfo nameFieldInfo , JBBPIntegerValueEvaluator expression ) {
221+ }
222+
204223 /**
205224 * Visit a primitive data field
206225 *
@@ -209,7 +228,7 @@ public void visitActionItem(int offsetInCompiledBlock, int actionType, JBBPInteg
209228 * @param nullableNameFieldInfo field info, null if the field is anonymous one
210229 * @param byteOrder byte order for the field, must not be null
211230 * @param readWholeStreamAsArray if true then it is array with unknown size till the stream end
212- * @param isFloatDoubleOrStringField flag shows that INT should be recognized as FLOAT and LONG as DOUBLE and BOOL as STRING
231+ * @param altFieldType flag shows that field type is alternative one, INT should be recognized as FLOAT and LONG as DOUBLE and BOOL as STRING
213232 * @param nullableArraySize array size if the field is array, null if the field is not array or variable length array
214233 * @see JBBPCompiler#CODE_BYTE
215234 * @see JBBPCompiler#CODE_UBYTE
@@ -218,8 +237,9 @@ public void visitActionItem(int offsetInCompiledBlock, int actionType, JBBPInteg
218237 * @see JBBPCompiler#CODE_BOOL
219238 * @see JBBPCompiler#CODE_INT
220239 * @see JBBPCompiler#CODE_LONG
240+ * @see JBBPCompiler#CODE_SKIP
221241 */
222- public void visitPrimitiveField (int offsetInCompiledBlock , int primitiveType , JBBPNamedFieldInfo nullableNameFieldInfo , JBBPByteOrder byteOrder , boolean readWholeStreamAsArray , boolean isFloatDoubleOrStringField , JBBPIntegerValueEvaluator nullableArraySize ) {
242+ public void visitPrimitiveField (int offsetInCompiledBlock , int primitiveType , JBBPNamedFieldInfo nullableNameFieldInfo , JBBPByteOrder byteOrder , boolean readWholeStreamAsArray , boolean altFieldType , JBBPIntegerValueEvaluator nullableArraySize ) {
223243 }
224244
225245 /**
0 commit comments