lib/jsduck/override.rb in jsduck-4.4.1 vs lib/jsduck/override.rb in jsduck-4.5.0
- old
+ new
@@ -30,11 +30,11 @@
return Logger.warn(:extend, "Class #{override[:override]} not found", ctx[:filename], ctx[:linenr])
end
# Combine comments of classes
if override[:doc].length > 0
- add_doc(target, "**From override #{override[:name]}:** " + override[:doc])
+ add_doc(target, "**From override #{get_name(override)}:** " + override[:doc])
end
target[:files] += override[:files]
# Build lookup table of existing members
existing = {}
@@ -46,23 +46,31 @@
# the docs. Otherwise add the member as a whole to the class.
each_member(override) do |m|
ex = existing[m[:id]]
if ex
if m[:doc].length > 0
- add_doc(ex, "**From override #{override[:name]}:** " + m[:doc])
+ add_doc(ex, "**From override #{get_name(override)}:** " + m[:doc])
else
- add_doc(ex, "**Overridden in #{override[:name]}.**")
+ add_doc(ex, "**Overridden in #{get_name(override)}.**")
end
ex[:files] += m[:files]
else
add_member(target, m)
- add_doc(m, "**Defined in override #{override[:name]}.**")
+ add_doc(m, "**Defined in override #{get_name(override)}.**")
m[:owner] = target[:name]
end
end
end
# helpers
+
+ def get_name(override)
+ if override[:name] != ""
+ override[:name]
+ else
+ override[:files][0][:filename]
+ end
+ end
def each_member(cls)
cls[:members].each {|m| yield m }
end