/** * Check if the node is for {@code super(this)} but not * {@code super(this).call()}. The incoming tree shape is: * * <pre> * MemberAccessExpressionID(FunctionCallID(SuperID(void), ContainerID(IdentifierID(void))), qname) * </pre> * * @return "0" if the node represents {@code super(this)}; * {@link Integer#MAX_VALUE} otherwise. */ public static int isSuperThisForFieldAccess(IASNode n) { // super(this).callSomething() is handled by another pattern that emits // "callsuper" instruction. if (n.getParent() instanceof FunctionCallNode) return Integer.MAX_VALUE; // The following unguarded casts are safe, because this is a cost // function and the pattern matcher has checked all the node IDs. final MemberAccessExpressionNode memberAccessNode = (MemberAccessExpressionNode)n; final FunctionCallNode callNode = (FunctionCallNode)memberAccessNode.getLeftOperandNode(); final IdentifierNode idNode = (IdentifierNode)callNode.getArgumentsNode().getChild(0); if (idNode.getName().equals(IASKeywordConstants.THIS)) return 1; else return Integer.MAX_VALUE; }
/** * Check if the node is for {@code super(this)} but not * {@code super(this).call()}. The incoming tree shape is: * * <pre> * MemberAccessExpressionID(FunctionCallID(SuperID(void), ContainerID(IdentifierID(void))), qname) * </pre> * * @return "0" if the node represents {@code super(this)}; * {@link Integer#MAX_VALUE} otherwise. */ public static int isSuperThisForFieldAccess(IASNode n) { // super(this).callSomething() is handled by another pattern that emits // "callsuper" instruction. if (n.getParent() instanceof FunctionCallNode) return Integer.MAX_VALUE; // The following unguarded casts are safe, because this is a cost // function and the pattern matcher has checked all the node IDs. final MemberAccessExpressionNode memberAccessNode = (MemberAccessExpressionNode)n; final FunctionCallNode callNode = (FunctionCallNode)memberAccessNode.getLeftOperandNode(); final IdentifierNode idNode = (IdentifierNode)callNode.getArgumentsNode().getChild(0); if (idNode.getName().equals(IASKeywordConstants.THIS)) return 1; else return Integer.MAX_VALUE; }
TypeDefinitionBase type = (TypeDefinitionBase)((MemberAccessExpressionNode)iNode).getLeftOperandNode().resolveType(project); starting_scope = ((TypeDefinitionBase)((MemberAccessExpressionNode)iNode).getLeftOperandNode().resolveType(project)).getContainedScope(); is_static_reference = ((MemberAccessExpressionNode)iNode).getLeftOperandNode().resolve(project) instanceof ClassDefinition; TypeDefinitionBase type = (TypeDefinitionBase)member_node.getLeftOperandNode().resolveType(project); if ( type != null ) is_static_reference = member_node.getLeftOperandNode().resolve(project) instanceof ClassDefinition;
TypeDefinitionBase type = (TypeDefinitionBase)((MemberAccessExpressionNode)iNode).getLeftOperandNode().resolveType(project); starting_scope = ((TypeDefinitionBase)((MemberAccessExpressionNode)iNode).getLeftOperandNode().resolveType(project)).getContainedScope(); is_static_reference = ((MemberAccessExpressionNode)iNode).getLeftOperandNode().resolve(project) instanceof ClassDefinition; TypeDefinitionBase type = (TypeDefinitionBase)member_node.getLeftOperandNode().resolveType(project); if ( type != null ) is_static_reference = member_node.getLeftOperandNode().resolve(project) instanceof ClassDefinition;
public ICompilerProblem isMissingMember(IASNode iNode) { if (iNode instanceof IdentifierNode && iNode.getParent() instanceof MemberAccessExpressionNode) { MemberAccessExpressionNode mae = (MemberAccessExpressionNode)(iNode.getParent()); if (iNode == mae.getRightOperandNode()) { ITypeDefinition leftDef = mae.getLeftOperandNode().resolveType(project); if (!leftDef.isDynamic()) return new AccessUndefinedMemberProblem(iNode, ((IdentifierNode)iNode).getName(), leftDef.getQualifiedName()); } } return null; }
result = member_node.getLeftOperandNode().resolveType(project); result = member_node.getLeftOperandNode().resolveType(project);
result = member_node.getLeftOperandNode().resolveType(project); result = member_node.getLeftOperandNode().resolveType(project);
public ICompilerProblem isMissingMember(IASNode iNode) { if (iNode instanceof IdentifierNode && iNode.getParent() instanceof MemberAccessExpressionNode) { MemberAccessExpressionNode mae = (MemberAccessExpressionNode)(iNode.getParent()); if (iNode == mae.getRightOperandNode()) { ITypeDefinition leftDef = mae.getLeftOperandNode().resolveType(project); if (!leftDef.isDynamic()) return new AccessUndefinedMemberProblem(iNode, ((IdentifierNode)iNode).getName(), leftDef.getQualifiedName()); } } return null; }
IExpressionNode leftNode = ((MemberAccessExpressionNode)obj).getLeftOperandNode(); IExpressionNode rightNode = ((MemberAccessExpressionNode)obj).getRightOperandNode(); leftDef = leftNode.resolveType(project);
IExpressionNode leftNode = ((MemberAccessExpressionNode)obj).getLeftOperandNode(); leftDef = leftNode.resolveType(project); if (leftDef != null && leftDef.isInstanceOf(project.getProxyBaseClass(), project)) leftNode = ((MemberAccessExpressionNode)leftNode).getLeftOperandNode(); leftDef = leftNode.resolveType(project); if (leftDef != null && leftDef.isInstanceOf(project.getProxyBaseClass(), project))
/** * resolveType on an XML expression returns null * (see IdentiferNode.resolveType). * So, we have to walk the tree ourselves and resolve * individual pieces. * @param obj * @return */ public boolean isXML(IExpressionNode obj) { // See if the left side is XML or XMLList IDefinition leftDef = obj.resolveType(getWalker().getProject()); if (leftDef == null && obj.getNodeID() == ASTNodeID.MemberAccessExpressionID) { return isXML(((MemberAccessExpressionNode)obj).getLeftOperandNode()); } return IdentifierNode.isXMLish(leftDef, getWalker().getProject()); }
&& !(op.startsWith("<") || op.startsWith(">") || op .startsWith("!")); getWalker().walk(dateNode.getLeftOperandNode()); String rightName = rightSide.getName(); if (isAssignment) getWalker().walk(dateNode.getLeftOperandNode()); write(ASEmitterTokens.MEMBER_ACCESS); write(propGetter.getFunctionName());
IExpressionNode left = node.getLeftOperandNode(); if (left instanceof FunctionCallNode) // probably a cast
private String buildChain(MemberAccessExpressionNode mae) { IExpressionNode left = mae.getLeftOperandNode(); if (left.getNodeID() == ASTNodeID.IdentifierID) { IExpressionNode right = mae.getRightOperandNode(); if (right.getNodeID() == ASTNodeID.IdentifierID) { return ((IdentifierNode)left).getName() + "." + ((IdentifierNode)right).getName(); } } else if (left.getNodeID() == ASTNodeID.MemberAccessExpressionID) { IExpressionNode right = mae.getRightOperandNode(); if (right.getNodeID() == ASTNodeID.IdentifierID) { String l = buildChain((MemberAccessExpressionNode)left); if (l == null) return null; return l + "." + ((IdentifierNode)right).getName(); } } return null; } }
if ( maex.stemIsPackage() && maex.getLeftOperandNode() instanceof IdentifierNode ) ((IdentifierNode)maex.getLeftOperandNode()).getName() );
IExpressionNode left = node.getLeftOperandNode(); if (left instanceof FunctionCallNode) // probably a cast
if ( maex.stemIsPackage() && maex.getLeftOperandNode() instanceof IdentifierNode ) ((IdentifierNode)maex.getLeftOperandNode()).getName() );
private String buildChain(MemberAccessExpressionNode mae) { IExpressionNode left = mae.getLeftOperandNode(); if (left.getNodeID() == ASTNodeID.IdentifierID) { IExpressionNode right = mae.getRightOperandNode(); if (right.getNodeID() == ASTNodeID.IdentifierID) { return ((IdentifierNode)left).getName() + "." + ((IdentifierNode)right).getName(); } } else if (left.getNodeID() == ASTNodeID.MemberAccessExpressionID) { IExpressionNode right = mae.getRightOperandNode(); if (right.getNodeID() == ASTNodeID.IdentifierID) { String l = buildChain((MemberAccessExpressionNode)left); if (l == null) return null; return l + "." + ((IdentifierNode)right).getName(); } } return null; } }
IExpressionNode left = node.getLeftOperandNode(); if (left instanceof FunctionCallNode) // probably a cast
IExpressionNode leftNode = obj.getLeftOperandNode(); IExpressionNode rightNode = obj.getRightOperandNode(); ASTNodeID rightID = rightNode.getNodeID();