mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[apps/ion] Escapes cases when records/ strings are null
This commit is contained in:
@@ -58,16 +58,10 @@ Ion::Storage::Record GlobalContext::RecordWithName(const char * name) {
|
||||
return Ion::Storage::sharedStorage()->recordBaseNamedWithExtensions(name, extensions, 2);
|
||||
}
|
||||
|
||||
const char * GlobalContext::ExtensionForExpression(const Expression & exp) {
|
||||
// TODO Once we have matrix exact reducing, add a .mat extension and check here if the root is a matrix
|
||||
// TODO .seq
|
||||
if (exp.type() == ExpressionNode::Type::Function) {
|
||||
return funcExtension;
|
||||
}
|
||||
return expExtension;
|
||||
}
|
||||
|
||||
const Expression GlobalContext::expressionForSymbolAndRecord(const SymbolAbstract & symbol, Ion::Storage::Record r) {
|
||||
if (r.isNull()) {
|
||||
return Expression();
|
||||
}
|
||||
if (symbol.type() == ExpressionNode::Type::Symbol) {
|
||||
return expressionForActualSymbol(symbol, r);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ void StorageExpressionModel::text(char * buffer, size_t bufferSize) const {
|
||||
}
|
||||
|
||||
Expression StorageExpressionModel::expression() const {
|
||||
if (m_expression.isUninitialized()) {
|
||||
if (m_expression.isUninitialized() && !m_record.isNull()) {
|
||||
m_expression = Expression::ExpressionFromAddress(expressionAddress(), expressionSize());
|
||||
}
|
||||
return m_expression;
|
||||
@@ -51,7 +51,7 @@ Expression StorageExpressionModel::reducedExpression(Poincare::Context * context
|
||||
}
|
||||
|
||||
Layout StorageExpressionModel::layout() {
|
||||
if (m_layout.isUninitialized()) {
|
||||
if (m_layout.isUninitialized() && !m_record.isNull()) {
|
||||
m_layout = PoincareHelpers::CreateLayout(expression());
|
||||
if (m_layout.isUninitialized()) {
|
||||
m_layout = HorizontalLayout();
|
||||
|
||||
@@ -414,6 +414,9 @@ bool Storage::FullNameCompliant(const char * fullName) {
|
||||
}
|
||||
|
||||
bool Storage::FullNameHasExtension(const char * fullName, const char * extension, size_t extensionLength) {
|
||||
if (fullName == nullptr) {
|
||||
return false;
|
||||
}
|
||||
size_t fullNameLength = strlen(fullName);
|
||||
if (fullNameLength > extensionLength) {
|
||||
const char * ext = fullName + fullNameLength - extensionLength;
|
||||
|
||||
Reference in New Issue
Block a user