Skip to content

Commit

Permalink
https://github.com/crowlogic/arb4j/issues/253
Browse files Browse the repository at this point in the history
  • Loading branch information
crowlogic committed Dec 23, 2024
1 parent d7d1e9d commit b4148c8
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 1,537 deletions.

Large diffs are not rendered by default.

58 changes: 1 addition & 57 deletions src/main/java/arb/expressions/Expression.java
Original file line number Diff line number Diff line change
Expand Up @@ -383,15 +383,6 @@ protected void addChecksForNullVariableReferences(MethodVisitor mv)
}
}

/**
* Calls this{@link #newIntermediateVariable(Class)} followed by
* this{@link #loadThisFieldOntoStack(MethodVisitor, String, Class)} with the
* newly assigned intermediate variable
*
* @param methodVisitor
* @param type
* @return
*/
public String allocateIntermediateVariable(MethodVisitor methodVisitor, Class<?> type)
{
assert !type.isInterface() : "cannot instantiate interface " + type;
Expand Down Expand Up @@ -608,19 +599,6 @@ protected Class<F> defineClass()
return compiledClass = loadFunctionClass(className, instructionByteCodes, context);
}

/**
* Process the next character
*
* @return a parenthetical {@link Node}, a {@link ProductNode}, a
* {@link LiteralConstantNode},a {@link Function}, a
* {@link VariableNode} or null if for instance "-t" is encountered, as
* a 0 is implied by the absence of a node before the
* {@link SubtractionNode} operator is encountered, also handles
* {@link ProductNode} also known as the product operator and
* {@link SumNode}
*
* @throws CompilerException
*/
@SuppressWarnings("unchecked")
public <N extends Node<D, C, F>> N evaluate() throws CompilerException
{
Expand Down Expand Up @@ -674,12 +652,6 @@ protected Node<D, C, F> evaluateIndex()
return index == null ? index = evaluateSubscriptedIndex() : index;
}

/**
*
* @param startPos
* @return a new {@link VariableReference} constructed from the results of
* calling this{@link #parseName()} and this{@link #evaluateIndex()}
*/
protected VariableReference<D, C, F> evaluateName(int startPos)
{
String identifier = parseName(startPos);
Expand All @@ -688,12 +660,6 @@ protected VariableReference<D, C, F> evaluateName(int startPos)
index);
}

/**
*
* @return a new {@link LiteralConstantNode} constucted by iterating
* this{@link #nextCharacter()} while {@link Parser#isNumeric(char)}
* applied to this{@link #character} is true
*/
protected Node<D, C, F> evaluateNumber()
{
int startingPosition = position;
Expand Down Expand Up @@ -1647,19 +1613,6 @@ public String newIntermediateVariable(String prefix, Class<?> type)
return newIntermediateVariable(prefix, type, true);
}

/**
* Assigns the next field name in the sequence for the given variable name
* prefix by calling
* this{@link #getNextIntermediateVariableFieldName(String, Class)} then passing
* the result to this{@link #registerIntermediateVariable(String, Class)}
*
* @param prefix
* @param type
* @param initialize if true then "this.field=new FieldType()" is generated
* otherwise its not
*
* @return the variable name assigned
*/
public String newIntermediateVariable(String prefix, Class<?> type, boolean initialize)
{
assert prefix != null : "name shan't be null";
Expand Down Expand Up @@ -1803,16 +1756,6 @@ public boolean references(VariableReference<D, C, F> reference)
return referencedVariables.containsKey(reference.name);
}

/**
* {@link Node}s can call this to register a {@link Consumer} of
* {@link MethodVisitor} to have its {@link Consumer#accept(Object)} method
* called during the declaration of the body of the {@link Initializable}
* interface method implementation {@link Initializable#initialize()} of the
* {@link Function} being generated by this {@link Expression}
*
* @param consumer
* @return
*/
public Expression<D, C, F> registerInitializer(Consumer<MethodVisitor> consumer)
{
initializers.add(consumer);
Expand Down Expand Up @@ -2314,3 +2257,4 @@ public LiteralConstantNode<D, C, F> newLiteralConstant(int i)
}

}

Loading

0 comments on commit b4148c8

Please sign in to comment.