[apps/shared/global_context] Inline SetExpressionForFunctionRecord

This commit is contained in:
Ruben Dashyan
2019-07-23 16:56:45 +02:00
committed by Léa Saviot
parent f4f45caf19
commit 84130236a8
2 changed files with 2 additions and 9 deletions

View File

@@ -118,13 +118,13 @@ Ion::Storage::Record::ErrorStatus GlobalContext::SetExpressionForActualSymbol(co
return Ion::Storage::sharedStorage()->createRecordWithExtension(symbol.name(), Ion::Storage::expExtension, expression.addressInPool(), expression.size());
}
Ion::Storage::Record::ErrorStatus GlobalContext::SetExpressionForFunctionRecord(Expression expressionToStore, Ion::Storage::Record previousRecord, const char * baseName) {
Ion::Storage::Record::ErrorStatus GlobalContext::SetExpressionForFunction(const Expression & expressionToStore, const SymbolAbstract & symbol, Ion::Storage::Record previousRecord) {
Ion::Storage::Record recordToSet = previousRecord;
Ion::Storage::Record::ErrorStatus error = Ion::Storage::Record::ErrorStatus::None;
if (!Ion::Storage::FullNameHasExtension(previousRecord.fullName(), Ion::Storage::funcExtension, strlen(Ion::Storage::funcExtension))) {
// The previous record was not a function. Destroy it and create the new record.
previousRecord.destroy();
CartesianFunction newModel = CartesianFunction::NewModel(&error, baseName);
CartesianFunction newModel = CartesianFunction::NewModel(&error, symbol.name());
if (error != Ion::Storage::Record::ErrorStatus::None) {
return error;
}
@@ -134,10 +134,6 @@ Ion::Storage::Record::ErrorStatus GlobalContext::SetExpressionForFunctionRecord(
return error;
}
Ion::Storage::Record::ErrorStatus GlobalContext::SetExpressionForFunction(const Expression & expressionToStore, const SymbolAbstract & symbol, Ion::Storage::Record previousRecord) {
return SetExpressionForFunctionRecord(expressionToStore, previousRecord, symbol.name());
}
Ion::Storage::Record GlobalContext::SymbolAbstractRecordWithBaseName(const char * name) {
return Ion::Storage::sharedStorage()->recordBaseNamedWithExtensions(name, k_extensions, k_numberOfExtensions);
}

View File

@@ -26,9 +26,6 @@ public:
static const Poincare::Layout LayoutForRecord(Ion::Storage::Record record);
// Set expression for record
static Ion::Storage::Record::ErrorStatus SetExpressionForFunctionRecord(Poincare::Expression e, Ion::Storage::Record record, const char * baseName);
// Destroy records
static void DestroyRecordsBaseNamedWithoutExtension(const char * baseName, const char * extension);