Commit b08359e8 authored by Richard Angersbach's avatar Richard Angersbach
Browse files

Make get function in IR_LayoutTransformationCollection companion return an option.

parent c967bcac
......@@ -35,9 +35,10 @@ object IR_DataBuffer {
}
// determines if field layout was transformed
def inLayoutTransformationCollection(field: IR_Field) = IR_LayoutTransformationCollection.get.trafoStmts
.collect { case stmt : IR_GenericTransform => stmt } // only consider generic transformations
.exists(_.fields.exists { case (name, lvl) => name == field.name && lvl == field.level }) // check if any trafo contains field
def inLayoutTransformationCollection(field: IR_Field) = IR_LayoutTransformationCollection.getOpt.isDefined &&
IR_LayoutTransformationCollection.getOpt.get.trafoStmts
.collect { case stmt : IR_GenericTransform => stmt } // only consider generic transformations
.exists(_.fields.exists { case (name, lvl) => name == field.name && lvl == field.level }) // check if any trafo contains field
// reduce the number of duplicate declarations in the target code for identical dimensionalities
private val dimensionalityMap : mutable.HashMap[String, IR_VariableDeclaration] = mutable.HashMap()
......
......@@ -32,10 +32,10 @@ object IR_LayoutTransformationCollection extends ObjectWithState {
override def clear() = { selfRef = None }
// looks itself up starting from the current root
def get = {
def getOpt = {
if (selfRef.isEmpty)
selfRef = StateManager.findFirst[IR_LayoutTransformationCollection]()
selfRef.get
selfRef
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment