Changeset 13927


Ignore:
Timestamp:
Nov 1, 2019 11:23:30 AM (3 weeks ago)
Author:
molsson
Message:

Merged revision(s) 13884, 13917 from branches/dev-mo-2278-merge:
#5843 Added new inherited attribute to check if component is in generated inner.
........
#5843 Extracted method connectorVariablePrefix() from myCausalityConnectorPrefix().
........
#5843 Removes CausalityConnectorPrefix from parameters when scalarizing records.
........
#5843 Added isParameter() and isDiscrete() to SrcComponentClause.
........
#5843 Made all fields in ScalarizingVariableInstance final.
........

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/Compiler/ModelicaFrontEnd/src/jastadd/flattening/Flattening.jrag

    r13675 r13927  
    17341734        }
    17351735        if (isConnectorVariable()) {
    1736             if (isInput()) {
    1737                 return CausalityConnectorPrefix.INPUT;
    1738             } else if (isOutput()) {
    1739                 return CausalityConnectorPrefix.OUTPUT;
    1740             } else if (isFlow()) {
    1741                 return CausalityConnectorPrefix.FLOW;
    1742             } else if (isStream()) {
    1743                 return CausalityConnectorPrefix.STREAM;
    1744             } else if (!variability().parameterOrLess()) {
    1745                 return CausalityConnectorPrefix.POTENTIAL;
    1746             } else {
    1747                 return CausalityConnectorPrefix.NONE;
    1748             }
     1736            return connectorVariablePrefix();
    17491737        } else {
    17501738            if (isInput()) {
     
    17551743                return CausalityConnectorPrefix.NONE;
    17561744            }
     1745        }
     1746    }
     1747   
     1748    /**
     1749     * Computes the {@link CausalityConnectorPrefix} this variable would have if it
     1750     * was a connector variable in a top-level connector.
     1751     */
     1752    public CausalityConnectorPrefix InstAssignable.connectorVariablePrefix() {
     1753        if (isInput()) {
     1754            return CausalityConnectorPrefix.INPUT;
     1755        } else if (isOutput()) {
     1756            return CausalityConnectorPrefix.OUTPUT;
     1757        } else if (isFlow()) {
     1758            return CausalityConnectorPrefix.FLOW;
     1759        } else if (isStream()) {
     1760            return CausalityConnectorPrefix.STREAM;
     1761        } else if (!variability().parameterOrLess()) {
     1762            return CausalityConnectorPrefix.POTENTIAL;
     1763        } else {
     1764            return CausalityConnectorPrefix.NONE;
    17571765        }
    17581766    }
  • trunk/Compiler/ModelicaFrontEnd/src/jastadd/instance/InnerOuter.jrag

    r10841 r13927  
    113113    eq BaseNode.getChild().isGeneratedInner()                       = false;
    114114
     115    inh boolean InstComponentDecl.isInGeneratedInner();
     116    eq InstGeneratedInner.getInstComponentDecl().isInGeneratedInner() = true;
     117    eq InstClassDecl.getChild().isInGeneratedInner()                  = false;
     118
    115119}
    116120
  • trunk/Compiler/ModelicaFrontEnd/src/jastadd/util/Util.jrag

    r13793 r13927  
    13131313   
    13141314
    1315     /**
    1316      * Check if this component is declared parameter.
    1317      */
    1318     syn boolean SrcComponentDecl.isParameter() = hasSrcTypePrefixVariability() && getSrcTypePrefixVariability().parameterVariability();
    1319    
    1320     /**
    1321      * Check if this component is declared constant.
    1322      */
    1323     syn boolean SrcComponentDecl.isConstant() = hasSrcTypePrefixVariability() && getSrcTypePrefixVariability().constantVariability();
    1324    
    1325     /**
    1326      * Check if this component clause is declared constant.
    1327      */
    1328     syn boolean SrcComponentClause.isConstant() = hasSrcTypePrefixVariability() && getSrcTypePrefixVariability().constantVariability();
    1329    
    1330     /**
    1331      * Check if this component is declared discrete.
    1332      */
    1333     syn boolean SrcComponentDecl.isDiscrete() = hasSrcTypePrefixVariability() && getSrcTypePrefixVariability().discreteVariability();
     1315    syn boolean SrcComponentDecl.isParameter() = myComponentClause().isParameter();
     1316    syn boolean SrcComponentDecl.isConstant()  = myComponentClause().isConstant();
     1317    syn boolean SrcComponentDecl.isDiscrete()  = myComponentClause().isDiscrete();
     1318   
     1319    syn boolean SrcComponentClause.isParameter() = hasSrcTypePrefixVariability() && getSrcTypePrefixVariability().parameterVariability();
     1320    syn boolean SrcComponentClause.isConstant()  = hasSrcTypePrefixVariability() && getSrcTypePrefixVariability().constantVariability();
     1321    syn boolean SrcComponentClause.isDiscrete()  = hasSrcTypePrefixVariability() && getSrcTypePrefixVariability().discreteVariability();
    13341322
    13351323    /**
  • trunk/Compiler/ModelicaMiddleEnd/src/jastadd/scalarization/Scalarization.jrag

    r13846 r13927  
    619619    public class ScalarizingVariableInstance {
    620620       
    621         private TypePrefixVariability variability;
    622        
    623         private VisibilityType visibility;
     621        private final TypePrefixVariability variability;
     622       
     623        private final VisibilityType visibility;
    624624       
    625625        // Binding expression
    626         private FExp bExp;
     626        private final FExp bExp;
    627627       
    628628        // (Mapped) attributes of this variable
    629         private Map<String, FAttribute> mattrs;
     629        private final Map<String, FAttribute> mattrs;
    630630       
    631631        // Full name of this variable
    632         private String name;
     632        private final String name;
    633633       
    634634        // input/output prefix of top-level variable
    635         private CausalityConnectorPrefix inputOutput;
    636        
    637         private Index index;
     635        private final CausalityConnectorPrefix inputOutput;
     636       
     637        private final Index index;
    638638       
    639639        private ScalarizingVariableInstance(String name, Map<String, FAttribute> mattrs, FExp be,
     
    645645            this.variability = variability;
    646646            this.visibility = visibility;
    647             this.inputOutput = inputOutput;
     647            /* If we have a record with input/output prefix that contains a parameter,
     648             * that parameter should not inherit the input/output prefix */
     649            this.inputOutput = variability.parameterOrLess() ? CausalityConnectorPrefix.NONE : inputOutput;
    648650        }
    649651       
Note: See TracChangeset for help on using the changeset viewer.