Skip to content

Commit

Permalink
[lldb] OptionValueProperties::Get[Set]PropertyAtIndexAsArgs should ha…
Browse files Browse the repository at this point in the history
…ndle OptionValueArgs
  • Loading branch information
tkrasnukha committed Feb 28, 2021
1 parent b2faf30 commit ef447fe
Showing 1 changed file with 38 additions and 26 deletions.
64 changes: 38 additions & 26 deletions lldb/source/Interpreter/OptionValueProperties.cpp
Expand Up @@ -248,38 +248,50 @@ OptionValueProperties::GetPropertyAtIndexAsOptionValueLanguage(
bool OptionValueProperties::GetPropertyAtIndexAsArgs(
const ExecutionContext *exe_ctx, uint32_t idx, Args &args) const {
const Property *property = GetPropertyAtIndex(exe_ctx, false, idx);
if (property) {
OptionValue *value = property->GetValue().get();
if (value) {
const OptionValueArray *array = value->GetAsArray();
if (array)
return array->GetArgs(args);
else {
const OptionValueDictionary *dict = value->GetAsDictionary();
if (dict)
return dict->GetArgs(args);
}
}
}
if (!property)
return false;

OptionValue *value = property->GetValue().get();
if (!value)
return false;

const OptionValueArgs *arguments = value->GetAsArgs();
if (arguments)
return arguments->GetArgs(args);

const OptionValueArray *array = value->GetAsArray();
if (array)
return array->GetArgs(args);

const OptionValueDictionary *dict = value->GetAsDictionary();
if (dict)
return dict->GetArgs(args);

return false;
}

bool OptionValueProperties::SetPropertyAtIndexFromArgs(
const ExecutionContext *exe_ctx, uint32_t idx, const Args &args) {
const Property *property = GetPropertyAtIndex(exe_ctx, true, idx);
if (property) {
OptionValue *value = property->GetValue().get();
if (value) {
OptionValueArray *array = value->GetAsArray();
if (array)
return array->SetArgs(args, eVarSetOperationAssign).Success();
else {
OptionValueDictionary *dict = value->GetAsDictionary();
if (dict)
return dict->SetArgs(args, eVarSetOperationAssign).Success();
}
}
}
if (!property)
return false;

OptionValue *value = property->GetValue().get();
if (!value)
return false;

OptionValueArgs *arguments = value->GetAsArgs();
if (arguments)
return arguments->SetArgs(args, eVarSetOperationAssign).Success();

OptionValueArray *array = value->GetAsArray();
if (array)
return array->SetArgs(args, eVarSetOperationAssign).Success();

OptionValueDictionary *dict = value->GetAsDictionary();
if (dict)
return dict->SetArgs(args, eVarSetOperationAssign).Success();

return false;
}

Expand Down

0 comments on commit ef447fe

Please sign in to comment.