@Override public void visitFieldReference(FieldReference node) { lombok.ast.Select select = new lombok.ast.Select(); select.astIdentifier(toIdentifier(node.token, node.nameSourcePosition)); select.astOperand((lombok.ast.Expression) toTree(node.receiver)); set(node, setPosition(node, select)); }
@Override public boolean visitSelect(Select node) { int start = posOfStructure(node.astIdentifier(), ".", true); int end = node.getPosition().getEnd(); return set(node, setPos(start, end, treeMaker.Select(toExpression(node.astOperand()), toName(node.astIdentifier())))); }
lombok.ast.Select current = node; while (true) { selects.add(current.astIdentifier()); pos.add(pos(current.astIdentifier())); if (current.astOperand() instanceof lombok.ast.Select) current = (lombok.ast.Select) current.astOperand(); else if (current.astOperand() instanceof lombok.ast.VariableReference) { selects.add(((lombok.ast.VariableReference) current.astOperand()).astIdentifier()); pos.add(pos(current.rawOperand())); Collections.reverse(selects); long[] posArray = new long[pos.size()]; FieldReference ref = new FieldReference(toName(node.astIdentifier()), pos(node)); ref.nameSourcePosition = pos(node.astIdentifier()); ref.receiver = toExpression(node.astOperand());
private boolean handleSelect(Select select) { if (select.toString().startsWith(R_DRAWABLE_PREFIX)) { String name = select.astIdentifier().astValue(); if (mNotificationIcons == null) { mNotificationIcons = Sets.newHashSet(); } mNotificationIcons.add(name); return true; } return false; }
@Override public boolean visitSelect(Select node) { // R.type.name if (node.astOperand() instanceof Select) { Select select = (Select) node.astOperand(); if (select.astOperand() instanceof VariableReference) { VariableReference reference = (VariableReference) select.astOperand(); if (reference.astIdentifier().astValue().equals(R_CLASS)) { String type = select.astIdentifier().astValue(); if (type.equals(MENU_TYPE)) { String name = node.astIdentifier().astValue(); // Reclassify icons in the given menu as action bar icons if (mMenuToIcons != null) { Collection<String> icons = mMenuToIcons.get(name); if (icons != null) { if (mActionBarIcons == null) { mActionBarIcons = Sets.newHashSet(); } mActionBarIcons.addAll(icons); } } } } } } return super.visitSelect(node); } }
@Override public boolean visitSelect(Select node) { if (node.astIdentifier().astValue().equals("layout") //$NON-NLS-1$ && node.astOperand() instanceof VariableReference && ((VariableReference) node.astOperand()).astIdentifier().astValue() .equals("R") //$NON-NLS-1$ && node.getParent() instanceof Select) { String layout = ((Select) node.getParent()).astIdentifier().astValue(); registerLayoutActivity(layout, mClassFqn); } return false; }
set(node, new Select().astIdentifier(id).rawOperand(toTree(node.getExpression())));
public Node createSelectOperation(Node identifier) { return posify(new Select().astIdentifier(createIdentifierIfNeeded(identifier, currentPos()))); }
@Override public boolean visitSelect(Select node) { parensOpen(node); formatter.buildInline(node); if (node.rawOperand() != null) { formatter.nameNextElement("operand"); visit(node.rawOperand()); formatter.append("."); } formatter.nameNextElement("selected"); visit(node.astIdentifier()); formatter.closeInline(); parensClose(node); return true; }
@Override public boolean visitMethodInvocation(MethodInvocation node) { if (node.astName().astValue().equals(SET_THEME)) { // Look at argument StrictListAccessor<Expression, MethodInvocation> args = node.astArguments(); if (args.size() == 1) { Expression arg = args.first(); if (arg instanceof Select) { String resource = arg.toString(); if (resource.startsWith(R_STYLE_PREFIX)) { if (mActivityToTheme == null) { mActivityToTheme = new HashMap<String, String>(); } String name = ((Select) arg).astIdentifier().astValue(); mActivityToTheme.put(mClassFqn, STYLE_RESOURCE_PREFIX + name); } } } } return false; } }
!(GRAVITY_CLASS.equals(((Select) parent).astOperand().toString()))) { return false;
public Node createLevel1Expression(org.parboiled.Node<Node> operand, List<org.parboiled.Node<Node>> operations) { Node current = operand.getValue(); if (operations == null) return current; for (org.parboiled.Node<Node> pNode : operations) { Node o = pNode.getValue(); if (o instanceof ArrayAccess) { current = ((ArrayAccess)o).rawOperand(current); } else if (o instanceof MethodInvocation) { current = ((MethodInvocation)o).rawOperand(current); } else if (o instanceof Select) { current = ((Select)o).rawOperand(current); } else { DanglingNodes.addDanglingNode(current, o); } positionSpan(o, operand, pNode); } return current; }
private List<String> unwrapSelectChain(Select s) { List<String> list = Lists.newArrayList(); while (s != null) { list.add(s.astIdentifier().astValue()); Expression parent = s.astOperand(); if (parent instanceof Select) { s = (Select) parent; } else if (parent instanceof Identifier) { s = null; list.add(((Identifier)parent).astValue()); } else if (parent == null) { break; } else { throw new ResolutionException(parent, "Identifies expected here, not a " + parent.getClass().getSimpleName()); } } Collections.reverse(list); return list; } }
if (mVisitResources) { if (node.astOperand() instanceof Select) { Select select = (Select) node.astOperand(); if (select.astOperand() instanceof VariableReference) { VariableReference reference = (VariableReference) select.astOperand(); if (reference.astIdentifier().astValue().equals(R_CLASS)) { String type = select.astIdentifier().astValue(); String name = node.astIdentifier().astValue(); if (node.astIdentifier().astValue().equals(R_CLASS)) { Node parent = node.getParent(); if (parent instanceof Select) { Node grandParent = parent.getParent(); if (grandParent instanceof Select) { Select select = (Select) grandParent; String name = select.astIdentifier().astValue(); Expression typeOperand = select.astOperand(); if (typeOperand instanceof Select) { Select typeSelect = (Select) typeOperand; String type = typeSelect.astIdentifier().astValue(); boolean isFramework = node.astOperand().toString().equals( ANDROID_PKG); for (VisitingDetector v : mResourceFieldDetectors) {
set(node, new Select().astIdentifier(id).rawOperand(toTree(node.getExpression())));
public Node createSelectOperation(Node identifier) { return posify(new Select().astIdentifier(createIdentifierIfNeeded(identifier, currentPos()))); }
@Override public boolean visitSelect(Select node) { parensOpen(node); formatter.buildInline(node); if (node.rawOperand() != null) { formatter.nameNextElement("operand"); visit(node.rawOperand()); formatter.append("."); } formatter.nameNextElement("selected"); visit(node.astIdentifier()); formatter.closeInline(); parensClose(node); return true; }
levelString = ((Select)isLoggableLevel).astIdentifier().astValue();
private void updateRestrictionFlags(lombok.ast.Node node, NameReference ref) { ref.bits &= ~ASTNode.RestrictiveFlagMASK; ref.bits |= Binding.VARIABLE; if (node.getParent() instanceof lombok.ast.MethodInvocation) { if (((lombok.ast.MethodInvocation)node.getParent()).astOperand() == node) { ref.bits |= Binding.TYPE; } } if (node.getParent() instanceof lombok.ast.Select) { if (((lombok.ast.Select)node.getParent()).astOperand() == node) { ref.bits |= Binding.TYPE; } } }
public Node createLevel1Expression(org.parboiled.Node<Node> operand, List<org.parboiled.Node<Node>> operations) { Node current = operand.getValue(); if (operations == null) return current; for (org.parboiled.Node<Node> pNode : operations) { Node o = pNode.getValue(); if (o instanceof ArrayAccess) { current = ((ArrayAccess)o).rawOperand(current); } else if (o instanceof MethodInvocation) { current = ((MethodInvocation)o).rawOperand(current); } else if (o instanceof Select) { current = ((Select)o).rawOperand(current); } else { DanglingNodes.addDanglingNode(current, o); } positionSpan(o, operand, pNode); } return current; }