/** * Explore a MemberAccessNode and * decide if it is a reference * to a package. * * This method will always return a result less than what isDottedName will return, * as package name must "win" over dotted name. */ int isPackageName(IASNode n) { int result = Integer.MAX_VALUE; if ( n instanceof MemberAccessExpressionNode ) { MemberAccessExpressionNode ma = (MemberAccessExpressionNode)n; if(ma.isPackageReference()) // This needs to be less than the value returned from isDottedName, // so that isPackageName wins result = 1; } return result; }
/** * Explore a MemberAccessNode and * decide if it is a reference * to a package. * * This method will always return a result less than what isDottedName will return, * as package name must "win" over dotted name. */ int isPackageName(IASNode n) { int result = Integer.MAX_VALUE; if ( n instanceof MemberAccessExpressionNode ) { MemberAccessExpressionNode ma = (MemberAccessExpressionNode)n; if(ma.isPackageReference()) // This needs to be less than the value returned from isDottedName, // so that isPackageName wins result = 1; } return result; }
@Override public boolean isDynamicExpression(ICompilerProject project) { // If this is a package reference, we're not dynamic. if (isPackageReference()) return false; return super.isDynamicExpression(project); }
@Override public IDefinition resolve(ICompilerProject project) { // A reference to a package won't resolve to anything. if (isPackageReference()) return null; // The definition that a member access expression resolves to will // always be the definition that its rightmost child resolves to // (e.g., the definition of c in a.b.c). return this.rightOperandNode.resolve(project); }
@Override public boolean isDynamicExpression(ICompilerProject project) { // If this is a package reference, we're not dynamic. if (isPackageReference()) return false; return super.isDynamicExpression(project); }
@Override public IDefinition resolve(ICompilerProject project) { // A reference to a package won't resolve to anything. if (isPackageReference()) return null; // The definition that a member access expression resolves to will // always be the definition that its rightmost child resolves to // (e.g., the definition of c in a.b.c). return this.rightOperandNode.resolve(project); }
/** * Explore a MemberAccessNode and decide if it is a reference to a package. * This method will always return a result less than what isDottedName will * return, as package name must "win" over dotted name. */ int isPackageName(IASNode n) { if (hookallreducercalls) hookforreducercalls("isPackageName"); int result = Integer.MAX_VALUE; if (n instanceof MemberAccessExpressionNode) { MemberAccessExpressionNode ma = (MemberAccessExpressionNode) n; if (ma.isPackageReference()) // This needs to be less than the value returned from // isDottedName, // so that isPackageName wins result = 1; } return result; }
/** * Determine if this identifier node is really part of a package reference. * this would be the node for b in 'a.b.c' if a.b.c was a known package name. * @return true if this identifier is used as part of a package reference. */ private boolean isPartOfPackageReference() { ExpressionNodeBase expr = this.getParentExpression(); MemberAccessExpressionNode memExpr = null; while (expr instanceof MemberAccessExpressionNode) { memExpr = (MemberAccessExpressionNode)expr; expr = expr.getParentExpression(); } if (memExpr != null) return memExpr.isPackageReference(); return false; }
/** * Determine if this identifier node is really part of a package reference. * this would be the node for b in 'a.b.c' if a.b.c was a known package name. * @return true if this identifier is used as part of a package reference. */ private boolean isPartOfPackageReference() { ExpressionNodeBase expr = this.getParentExpression(); MemberAccessExpressionNode memExpr = null; while (expr instanceof MemberAccessExpressionNode) { memExpr = (MemberAccessExpressionNode)expr; expr = expr.getParentExpression(); } if (memExpr != null) return memExpr.isPackageReference(); return false; }