Previous behavior was to return null.
Adapts existing clients by using the new MMLocalClass::has_global_property.
Signed-off-by: Jean Privat <jean@pryen.org>
if s == pc then
found = true
else if found and c.che < s then
- var p = s[g]
- if p != null then
+ if s.has_global_property(g) then
#print "found {s.module}::{s}::{p}"
- return p.cname
+ return s[g].cname
end
end
end
redef meth [](glob)
do
- var prop = super(glob)
- if prop == null and _global_properties.has(glob) then
- prop = inherit_local_property(glob)
+ if _local_property_by_global.has_key(glob) then
+ return _local_property_by_global[glob]
+ else if has_global_property(glob) then
+ return inherit_local_property(glob)
+ else
+ abort
end
- return prop
end
# Add default super class in direct parent and in super classes if this is not the Object class
# First compute the set of bottom properties
var impls = new ArraySet[MMLocalProperty]
for sc in supers do
- var p = sc[glob]
- if p != null then impls.add(p)
+ if sc.has_global_property(glob) then impls.add(sc[glob])
end
# Second, extract most specific
var impls2 = ghier.select_smallests(impls)
set_global(g)
var impls = new Array[MMLocalProperty]
for sc in local_class.che.direct_greaters do
- var p = sc[g]
- if p == null then continue
- impls.add(p)
+ if not sc.has_global_property(g) then continue
+ impls.add(sc[g])
end
g.add_local_property(self, impls)
end
end
else
for m in owned_modules do
- var mc = m[c.global]
- if mc != null and mc.need_doc(dctx) then
- new_classes.add(c)
- break
+ if m.global_classes.has(c.global) then
+ var mc = m[c.global]
+ if mc.need_doc(dctx) then
+ new_classes.add(c)
+ break
+ end
end
end
end
redef meth need_doc(dctx) do
if module == dctx.module then
for m in dctx.owned_modules do
- var c = m[global]
- if c != null and c.need_doc(dctx) then return true
+ if m.global_classes.has(global) then
+ var c = m[global]
+ if c.need_doc(dctx) then return true
+ end
end
end
return false
if p.local_class != self or not p.need_doc(dctx) then
var cla = new Array[MMLocalClass]
for m in dctx.owned_modules do
+ if not m.global_classes.has(global) then continue
var c = m[global]
- if c == null or not c isa MMConcreteClass then continue
+ if not c isa MMConcreteClass then continue
+ if not c.has_global_property(g) then continue
var p2 = c[g]
- if p2 == null or p2.local_class != c or not p2.need_doc(dctx) then continue
+ if p2.local_class != c or not p2.need_doc(dctx) then continue
cla.add(c)
end
if cla.is_empty then continue