| Index: Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/checks/AstUtil.java
|
| diff --git a/Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/checks/AstUtil.java b/Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/checks/AstUtil.java
|
| index 503c9b180cc8892ae29e5b8befba72c1510d30da..42426c9777bc3e5d1a696035cea6d6822fa97733 100644
|
| --- a/Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/checks/AstUtil.java
|
| +++ b/Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/checks/AstUtil.java
|
| @@ -24,21 +24,23 @@ public class AstUtil {
|
| }
|
|
|
| AstNode parentNode = functionNode.getParent();
|
| - if (parentNode == null) {
|
| - return null;
|
| - }
|
| -
|
| - switch (parentNode.getType()) {
|
| - case Token.COLON:
|
| - return ((ObjectProperty) parentNode).getLeft();
|
| - case Token.ASSIGN:
|
| - Assignment assignment = (Assignment) parentNode;
|
| - if (assignment.getRight() == functionNode) {
|
| - return assignment.getLeft();
|
| + while (parentNode != null) {
|
| + switch (parentNode.getType()) {
|
| + case Token.COLON:
|
| + return ((ObjectProperty) parentNode).getLeft();
|
| + case Token.ASSIGN:
|
| + Assignment assignment = (Assignment) parentNode;
|
| + if (assignment.getRight() == functionNode &&
|
| + assignment.getLeft().getType() == Token.NAME) {
|
| + return assignment.getLeft();
|
| + }
|
| + parentNode = assignment.getParent();
|
| + break;
|
| + case Token.VAR:
|
| + return ((VariableInitializer) parentNode).getTarget();
|
| + default:
|
| + return null;
|
| }
|
| - break;
|
| - case Token.VAR:
|
| - return ((VariableInitializer) parentNode).getTarget();
|
| }
|
|
|
| return null;
|
| @@ -76,21 +78,23 @@ public class AstUtil {
|
|
|
| // reader.onloadend = function() {...}
|
| AstNode parentNode = functionNode.getParent();
|
| - if (parentNode == null) {
|
| - return null;
|
| - }
|
| -
|
| - switch (parentNode.getType()) {
|
| - case Token.COLON:
|
| - return ((ObjectProperty) parentNode).getLeft().getJsDocNode();
|
| - case Token.ASSIGN:
|
| - Assignment assignment = (Assignment) parentNode;
|
| - if (assignment.getRight() == functionNode) {
|
| - return assignment.getJsDocNode();
|
| + while (parentNode != null) {
|
| + switch (parentNode.getType()) {
|
| + case Token.COLON:
|
| + return ((ObjectProperty) parentNode).getLeft().getJsDocNode();
|
| + case Token.ASSIGN:
|
| + Assignment assignment = (Assignment) parentNode;
|
| + if (assignment.getJsDocNode() != null) {
|
| + return assignment.getJsDocNode();
|
| + } else {
|
| + parentNode = assignment.getParent();
|
| + }
|
| + break;
|
| + case Token.VAR:
|
| + return parentNode.getParent().getJsDocNode();
|
| + default:
|
| + return null;
|
| }
|
| - break;
|
| - case Token.VAR:
|
| - return parentNode.getParent().getJsDocNode();
|
| }
|
|
|
| return null;
|
|
|