Changeset 14235


Ignore:
Timestamp:
Nov 29, 2019 3:16:12 PM (2 weeks ago)
Author:
amartensen
Message:

#5879 moved the NTA getGeneratedInnerModifications() to under InstClassDecl

Location:
branches/dev-2559/Compiler/ModelicaFrontEnd/src/jastadd
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-2559/Compiler/ModelicaFrontEnd/src/jastadd/ast/InstanceTree.ast

    r13396 r14235  
    4141                               [Dummy3:InstConstraining];      // Dummy node to prevent InstConstraining from being classified as root
    4242
    43 abstract InstClassDecl: InstBaseNode ::= <SrcClassDecl:SrcClassDecl> /[ClassAnnotation:InstClassModification]/ /FunctionType:FType/;
     43abstract InstClassDecl: InstBaseNode ::= <SrcClassDecl:SrcClassDecl> /[ClassAnnotation:InstClassModification]/ /FunctionType:FType/ /GeneratedInnerModifications:InstModification*/;
    4444abstract InstBaseClassDecl : InstClassDecl ::= [InstConstrainingClass] InstRestriction;
    4545InstLibNode              : InstClassDecl ::= /ActualInstClass:InstClassDecl/;
  • branches/dev-2559/Compiler/ModelicaFrontEnd/src/jastadd/errorcheck/ErrorCheck.jrag

    r14186 r14235  
    747747                    error = true;
    748748                }
    749                 for(AnnotationNode an : myInnerNode()) {
    750                     SrcModification inner = (SrcModification) an.ast();
    751                     InstModification im = inner.newInstModification();
    752                     im.setParent(this);
     749                for(InstModification im : containingInstClassDecl().getGeneratedInnerModificationsList()) {
    753750                    im.checkModificationNames(checkType);
    754751                }
     
    760757        }
    761758    }
    762    
     759
    763760    public void InstGeneratedInner.missingInnerWarning() {
    764761        // TODO: Use missingInnerMessage annotation
  • branches/dev-2559/Compiler/ModelicaFrontEnd/src/jastadd/instance/InnerOuter.jrag

    r14186 r14235  
    3838    syn boolean InstComponentDecl.inOrIsOuter() = isOuter() || inOuter();
    3939    syn boolean InstComponentDecl.inOrIsInner() = isInner() || inInner();
     40   
     41    eq InstClassDecl.getGeneratedInnerModifications().lookupInstClass(String name) = genericLookupInstClass(name);
    4042   
    4143    syn lazy InstComponentDecl InstComponentDecl.myInnerInstComponentDecl() {
     
    9395    syn nta List<InstGeneratedInner> InstClassDecl.getInstGeneratedInners() = new List<InstGeneratedInner>();
    9496
    95     eq InstGeneratedInner.getChild().lookupInstComponentInInstElement(String name) {
    96         InstComponentDecl icd = getInstComponentDecl();
    97         if (icd.matches(name)) {
    98             return InstLookupResult.<InstComponentDecl>found(icd);
     97    eq InstClassDecl.getGeneratedInnerModifications().lookupInstComponentInInstElement(String name) {
     98        for (InstGeneratedInner igi : getInstGeneratedInners()) {
     99            InstComponentDecl icd = igi.getInstComponentDecl();
     100            if (icd.matches(name)) {
     101                return InstLookupResult.<InstComponentDecl>found(icd);
     102            }
    99103        }
    100         return icd.genericLookupInstComponent(name);
     104        return InstLookupResult.<InstComponentDecl>notFound();
    101105    }
    102106
    103     eq InstGeneratedInner.getChild().myEnvironment()            = new Environment().mergeInnerClone(getGeneratedInnerModifications());
    104     eq InstGeneratedInner.getChild().myEnvironment(String name) = new Environment().mergeInnerClone(getGeneratedInnerModifications()).filter(name);
     107    eq InstGeneratedInner.getChild().myEnvironment()            = new Environment().mergeInnerClone(myGeneratedInnerModifications());
     108    eq InstGeneratedInner.getChild().myEnvironment(String name) = new Environment().mergeInnerClone(myGeneratedInnerModifications()).filter(name);
    105109   
    106     syn nta List<InstModification> InstGeneratedInner.getGeneratedInnerModifications() {
     110    inh List<InstModification> InstGeneratedInner.myGeneratedInnerModifications();
     111    eq InstClassDecl.getChild().myGeneratedInnerModifications() = getGeneratedInnerModificationsList();
     112
     113    syn lazy List<InstModification> InstClassDecl.getGeneratedInnerModificationsList() {
    107114        List<InstModification> res = new List<>();
    108         SrcModification annotation = myInnerAnnotation(name());
    109         if (annotation != null) {
     115        for(AnnotationNode an : annotation().vendorNode().forPath("inners")) {
     116            if (!an.exists()) {
     117                continue;
     118            }
     119            SrcModification annotation = (SrcModification) an.ast();
     120            if (annotation == null) {
     121                continue;
     122            }
    110123            res.add(annotation.newInstModification());
    111124        }
     125
    112126        return res;
    113127    }
    114128   
    115     inh AnnotationNode InstGeneratedInner.myInnerNode();
    116     eq BaseNode.getChild().myInnerNode()      = null;
    117     eq InstClassDecl.getChild().myInnerNode() = innerNode();
    118 
    119     inh SrcModification InstGeneratedInner.myInnerAnnotation(String name);
    120     eq BaseNode.getChild().myInnerAnnotation(String name) = null;
    121     eq InstClassDecl.getChild().myInnerAnnotation(String name) {
    122         AnnotationNode an = innerNode().forPath(name);
    123         if (!an.exists()) {
    124             return null;
    125         }
    126         return (SrcModification) an.ast();
    127     }
    128 
    129     syn AnnotationNode BaseNode.innerNode() = annotation().vendorNode().forPath("inners");
    130 
    131129    public InstGeneratedInner.InstGeneratedInner(InstClassDecl parent, InstComponentDecl outer, InstComponentDecl nonInner) {
    132130        this(parent.createInstComponentDecl(outer.getSrcComponentDecl()), outer, nonInner);
  • branches/dev-2559/Compiler/ModelicaFrontEnd/src/jastadd/instance/InstanceTree.jrag

    r14185 r14235  
    25602560    eq Root.getChild().containingInstNode()     = null;
    25612561   
    2562     inh InstNode FExternalStmt.containingInstClassDecl();
     2562    inh InstClassDecl InstGeneratedInner.containingInstClassDecl();
     2563    inh InstClassDecl FExternalStmt.containingInstClassDecl();
    25632564    eq Root.getChild().containingInstClassDecl()          = null;
    25642565    eq InstClassDecl.getChild().containingInstClassDecl() = this;
Note: See TracChangeset for help on using the changeset viewer.