Skip to content

Commit ef447fe

Browse files
committed
[lldb] OptionValueProperties::Get[Set]PropertyAtIndexAsArgs should handle OptionValueArgs
1 parent b2faf30 commit ef447fe

File tree

1 file changed

+38
-26
lines changed

1 file changed

+38
-26
lines changed

lldb/source/Interpreter/OptionValueProperties.cpp

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -248,38 +248,50 @@ OptionValueProperties::GetPropertyAtIndexAsOptionValueLanguage(
248248
bool OptionValueProperties::GetPropertyAtIndexAsArgs(
249249
const ExecutionContext *exe_ctx, uint32_t idx, Args &args) const {
250250
const Property *property = GetPropertyAtIndex(exe_ctx, false, idx);
251-
if (property) {
252-
OptionValue *value = property->GetValue().get();
253-
if (value) {
254-
const OptionValueArray *array = value->GetAsArray();
255-
if (array)
256-
return array->GetArgs(args);
257-
else {
258-
const OptionValueDictionary *dict = value->GetAsDictionary();
259-
if (dict)
260-
return dict->GetArgs(args);
261-
}
262-
}
263-
}
251+
if (!property)
252+
return false;
253+
254+
OptionValue *value = property->GetValue().get();
255+
if (!value)
256+
return false;
257+
258+
const OptionValueArgs *arguments = value->GetAsArgs();
259+
if (arguments)
260+
return arguments->GetArgs(args);
261+
262+
const OptionValueArray *array = value->GetAsArray();
263+
if (array)
264+
return array->GetArgs(args);
265+
266+
const OptionValueDictionary *dict = value->GetAsDictionary();
267+
if (dict)
268+
return dict->GetArgs(args);
269+
264270
return false;
265271
}
266272

267273
bool OptionValueProperties::SetPropertyAtIndexFromArgs(
268274
const ExecutionContext *exe_ctx, uint32_t idx, const Args &args) {
269275
const Property *property = GetPropertyAtIndex(exe_ctx, true, idx);
270-
if (property) {
271-
OptionValue *value = property->GetValue().get();
272-
if (value) {
273-
OptionValueArray *array = value->GetAsArray();
274-
if (array)
275-
return array->SetArgs(args, eVarSetOperationAssign).Success();
276-
else {
277-
OptionValueDictionary *dict = value->GetAsDictionary();
278-
if (dict)
279-
return dict->SetArgs(args, eVarSetOperationAssign).Success();
280-
}
281-
}
282-
}
276+
if (!property)
277+
return false;
278+
279+
OptionValue *value = property->GetValue().get();
280+
if (!value)
281+
return false;
282+
283+
OptionValueArgs *arguments = value->GetAsArgs();
284+
if (arguments)
285+
return arguments->SetArgs(args, eVarSetOperationAssign).Success();
286+
287+
OptionValueArray *array = value->GetAsArray();
288+
if (array)
289+
return array->SetArgs(args, eVarSetOperationAssign).Success();
290+
291+
OptionValueDictionary *dict = value->GetAsDictionary();
292+
if (dict)
293+
return dict->SetArgs(args, eVarSetOperationAssign).Success();
294+
283295
return false;
284296
}
285297

0 commit comments

Comments
 (0)