forked from eclipse-jdt/eclipse.jdt.core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
142 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Expression2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
package org.eclipse.jdt.core.dom; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* @since 3.39 | ||
*/ | ||
@SuppressWarnings({ "rawtypes" }) | ||
public class Expression2 extends ASTNode { | ||
/** | ||
* @since 3.39 | ||
*/ | ||
public static final ChildListPropertyDescriptor ELEMENTS_PROPERTY = | ||
new ChildListPropertyDescriptor(Expression2.class, "elements", ASTNode.class, NO_CYCLE_RISK); //$NON-NLS-1$ | ||
|
||
private static final List PROPERTY_DESCRIPTORS; | ||
|
||
static { | ||
List properyList = new ArrayList(5); | ||
createPropertyList(Expression2.class, properyList); | ||
addProperty(ELEMENTS_PROPERTY, properyList); | ||
PROPERTY_DESCRIPTORS = reapPropertyList(properyList); | ||
} | ||
|
||
public static List propertyDescriptors(int apiLevel) { | ||
return PROPERTY_DESCRIPTORS; | ||
} | ||
|
||
private ASTNode.NodeList elements = new ASTNode.NodeList(ELEMENTS_PROPERTY); | ||
|
||
Expression2(AST ast) { | ||
super(ast); | ||
} | ||
|
||
@Override | ||
final List internalStructuralPropertiesForType(int apiLevel) { | ||
return propertyDescriptors(apiLevel); | ||
} | ||
|
||
@Override | ||
final Object internalGetSetObjectProperty(SimplePropertyDescriptor property, boolean get, Object value) { | ||
// allow default implementation to flag the error | ||
return super.internalGetSetObjectProperty(property, get, value); | ||
} | ||
|
||
@Override | ||
final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property, boolean get, ASTNode child) { | ||
// allow default implementation to flag the error | ||
return super.internalGetSetChildProperty(property, get, child); | ||
} | ||
|
||
@Override | ||
final List internalGetChildListProperty(ChildListPropertyDescriptor property) { | ||
if (property == ELEMENTS_PROPERTY) { | ||
return elements(); | ||
} | ||
// allow default implementation to flag the error | ||
return super.internalGetChildListProperty(property); | ||
} | ||
|
||
@Override | ||
final int getNodeType0() { | ||
return EXPRESSION2; | ||
} | ||
|
||
@Override | ||
ASTNode clone0(AST target) { | ||
Expression2 result = new Expression2(target); | ||
result.setSourceRange(getStartPosition(), getLength()); | ||
result.elements().addAll(ASTNode.copySubtrees(target, elements())); | ||
return result; | ||
} | ||
|
||
@Override | ||
final boolean subtreeMatch0(ASTMatcher matcher, Object other) { | ||
// dispatch to correct overloaded match method | ||
return matcher.match(this, other); | ||
} | ||
|
||
@Override | ||
void accept0(ASTVisitor visitor) { | ||
boolean visitChildren = visitor.visit(this); | ||
if (visitChildren) { | ||
// visit children in normal left to right reading order | ||
acceptChildren(visitor, this.elements); | ||
} | ||
visitor.endVisit(this); | ||
} | ||
|
||
/** | ||
* @since 3.39 | ||
*/ | ||
public List elements() { | ||
return this.elements; | ||
} | ||
|
||
|
||
@Override | ||
int memSize() { | ||
// treat Operator as free | ||
return BASE_NODE_SIZE + 4 * 4; | ||
} | ||
|
||
@Override | ||
int treeSize() { | ||
return | ||
memSize() | ||
+ (this.elements == null ? 0 : this.elements.listSize()); | ||
} | ||
} |