public class MatchStatement extends Object
MatchPattern
along with a MatchGenerator
that can be evaluated to replace
one or more Node
s with a single Value
.Modifier and Type | Field and Description |
---|---|
private String[] |
arguments
The name of arguments in the order they are expected to be passed to the generator method.
|
private MatchGenerator |
generatorMethod
The method in the
NodeLIRBuilder subclass that will actually do the code emission. |
private static DebugMetric |
MatchStatementSuccess |
private String |
name
A printable name for this statement.
|
private MatchPattern |
pattern
The actual match pattern.
|
Constructor and Description |
---|
MatchStatement(String name,
MatchPattern pattern,
MatchGenerator generator,
String[] arguments) |
Modifier and Type | Method and Description |
---|---|
private Object[] |
buildArgList(MatchContext context) |
String |
formatMatch(Node root) |
boolean |
generate(NodeLIRBuilder builder,
int index,
Node node,
List<Node> nodes)
Attempt to match the current statement against a Node.
|
String |
getName() |
MatchPattern |
getPattern() |
String |
toString() |
private static final DebugMetric MatchStatementSuccess
private final String name
private final MatchPattern pattern
private MatchGenerator generatorMethod
NodeLIRBuilder
subclass that will actually do the code emission.public MatchStatement(String name, MatchPattern pattern, MatchGenerator generator, String[] arguments)
public boolean generate(NodeLIRBuilder builder, int index, Node node, List<Node> nodes)
builder
- the current builder instance.node
- the node to be matchednodes
- the nodes in the current blockComplexMatchResult
to be
evaluated by the NodeLIRBuilder.private Object[] buildArgList(MatchContext context)
context
- public String formatMatch(Node root)
public MatchPattern getPattern()