Skip to content

Commit

Permalink
fix printing cell array of strings
Browse files Browse the repository at this point in the history
  • Loading branch information
lawrence-mbf committed Feb 28, 2023
1 parent 5fa3101 commit 9382c12
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions +file/fillValidators.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@
for iProp = 1:length(prop)
p = prop(iProp);
assert(p.isConstrainedSet && ~isempty(p.type), 'Non-constrained anonymous set?');
constrained{iProp} = namespaceReg.getFullClassName(p.type);
constrained{iProp} = ['''', namespaceReg.getFullClassName(p.type), ''''];
end

unitValidationStr = strjoin({...
unitValidationStr, ...
['constrained = [', strtrim(evalc('disp(constrained)')), '];'], ...
['constrained = {', strjoin(constrained, ', '), '};'], ...
['types.util.checkSet(''', name, ''', struct(), constrained, val);'], ...
}, newline);
elseif isa(prop, 'file.Dataset')
Expand Down Expand Up @@ -76,7 +77,7 @@
else
type = namespaceReg.getFullClassName(dataset.type);
if dataset.isConstrainedSet
constraints = [constraints {type}];
constraints{end+1} = type;
else
namedprops.(dataset.name) = type;
end
Expand All @@ -94,7 +95,7 @@
assert(~isempty(subGroup.type), 'Weird case with two untyped groups');

if isempty(subGroup.name)
constraints = [constraints {subGroupFullName}];
constraints{end+1} = subGroupFullName;
else
namedprops.(subGroup.name) = subGroupFullName;
end
Expand Down Expand Up @@ -126,9 +127,13 @@
['namedprops.' nm ' = ''' namedprops.(nm) ''';']}, newline);
end

for iConstraint = 1:length(constraints)
constraints{iConstraint} = ['''', constraints{iConstraint}, ''''];
end

unitValidationStr = strjoin({...
unitValidationStr, ...
['constrained = ', strtrim(evalc('disp(constraints)')), ';'], ...
['constrained = {', strjoin(constraints, ','), '};'], ...
['types.util.checkSet(''', name, ''', namedprops, constrained, val);'], ...
}, newline);
end
Expand Down

0 comments on commit 9382c12

Please sign in to comment.