-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathUnaryExpression.java
More file actions
39 lines (33 loc) · 1.02 KB
/
UnaryExpression.java
File metadata and controls
39 lines (33 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.semmle.js.ast;
/**
* A unary expression such as <code>!x</code> or <code>void(0)</code>.
*
* <p>Note that increment and decrement expressions are represented by {@link UpdateExpression}.
*/
public class UnaryExpression extends Expression {
private final String operator;
private final Expression argument;
private final boolean prefix;
public UnaryExpression(SourceLocation loc, String operator, Expression argument, Boolean prefix) {
super("UnaryExpression", loc);
this.operator = operator;
this.argument = argument;
this.prefix = prefix.equals(Boolean.TRUE);
}
@Override
public <Q, A> A accept(Visitor<Q, A> v, Q q) {
return v.visit(this, q);
}
/** The operator of this unary expression. */
public String getOperator() {
return operator;
}
/** The argument of this unary expression. */
public Expression getArgument() {
return argument;
}
/** Is the operator of this unary expression a prefix operator? */
public boolean isPrefix() {
return prefix;
}
}