Skip to content

Commit

Permalink
Add extra generated checks for attributes
Browse files Browse the repository at this point in the history
If the attribute is dependent on another property, then the dependent
object should be treated as empty if the object is a link.
  • Loading branch information
lawrence-mbf committed Jul 24, 2023
1 parent 12f1996 commit ff43b5c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion +file/fillExport.m
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,10 @@
flattened = strrep(elisions(1:flattened(end)), '/', '_');
depPropname = [flattened prop.dependent];
end
propertyChecks{end+1} = ['~isempty(obj.' depPropname ')'];
propertyReference = sprintf('obj.%s', depPropname);
propertyChecks{end+1} = sprintf(['~isempty(%1$s) ' ...
'&& ~isa(%1$s, ''types.untyped.SoftLink'') ' ...
'&& ~isa(%1$s, ''types.untyped.ExternalLink'')'], propertyReference);
end

if ~prop.required
Expand Down

0 comments on commit ff43b5c

Please sign in to comment.