Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1385)

Unified Diff: Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/checks/ProtoFollowsExtendsChecker.java

Issue 319733002: DevTools: [JsDocValidator] Be smarter about function name and JSDoc detection (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix constructor detection for unnamed functions Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/checks/ProtoFollowsExtendsChecker.java
diff --git a/Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/checks/ProtoFollowsExtendsChecker.java b/Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/checks/ProtoFollowsExtendsChecker.java
index 8a7d86d713481c800ee610249518a94ba59f5656..23090aba4d04d8db80abaf2b3f1a3203bea54bc1 100644
--- a/Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/checks/ProtoFollowsExtendsChecker.java
+++ b/Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/checks/ProtoFollowsExtendsChecker.java
@@ -161,23 +161,29 @@ public final class ProtoFollowsExtendsChecker extends ContextTrackingChecker {
}
typesWithAssignedProto.add(currentType);
String value = state.getNodeText(node.getRight());
- if (!AstUtil.isPrototypeName(value)) {
+ boolean isNullPrototype = "null".equals(value);
+ if (!isNullPrototype && !AstUtil.isPrototypeName(value)) {
reportErrorAtNodeStart(
node.getRight(), "__proto__ value is not a prototype");
return;
}
- String superType = AstUtil.getTypeNameFromPrototype(value);
+ String superType = isNullPrototype ? "null" : AstUtil.getTypeNameFromPrototype(value);
if (type.isInterface) {
reportErrorAtNodeStart(node.getLeft(), String.format(
"__proto__ defined for interface %s", type.typeName));
return;
} else {
- if (type.extendedTypes.isEmpty()) {
+ if (!isNullPrototype && type.extendedTypes.isEmpty()) {
reportErrorAtNodeStart(node.getRight(), String.format(
"No @extends annotation for %s extending %s", type.typeName, superType));
return;
}
}
+
+ if (isNullPrototype) {
+ return;
+ }
+
// FIXME: Should we check that there is only one @extend-ed type
// for the non-interface |type|? Closure is supposed to do this anyway...
InheritanceEntry entry = type.getFirstExtendedType();

Powered by Google App Engine
This is Rietveld 408576698