Esempio n. 1
0
 /**
  * Return the body of the function that contains the given parameter, or {@code null} if no
  * function body could be found.
  *
  * @param node the parameter contained in the function whose body is to be returned
  * @return the body of the function that contains the given parameter
  */
 private FunctionBody getFunctionBody(FormalParameter node) {
   ASTNode parent = node.getParent();
   while (parent != null) {
     if (parent instanceof ConstructorDeclaration) {
       return ((ConstructorDeclaration) parent).getBody();
     } else if (parent instanceof FunctionExpression) {
       return ((FunctionExpression) parent).getBody();
     } else if (parent instanceof MethodDeclaration) {
       return ((MethodDeclaration) parent).getBody();
     }
     parent = parent.getParent();
   }
   return null;
 }