Changeset 14121


Ignore:
Timestamp:
Nov 19, 2019 3:05:25 PM (3 weeks ago)
Author:
amartensen
Message:

#5879 improved name lookup in InstGeneratedInner. removed implicit space added in r14107.

Location:
branches/dev-mo-2559/Compiler
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-mo-2559/Compiler/ModelicaFrontEnd/src/jastadd/instance/InnerOuter.jrag

    r13948 r14121  
    9393    syn nta List<InstGeneratedInner> InstClassDecl.getInstGeneratedInners() = new List<InstGeneratedInner>();
    9494
    95     eq InstGeneratedInner.getChild().myEnvironment() = new Environment();
    96     eq InstGeneratedInner.getChild().myEnvironment(String name) = new Environment();
     95    eq InstGeneratedInner.getChild().lookupInstComponentInInstElement(String name) {
     96        InstComponentDecl icd = getInstComponentDecl();
     97        if (icd.matches(name)) {
     98            return InstLookupResult.<InstComponentDecl>found(icd);
     99        }
     100        return icd.genericLookupInstComponent(name);
     101    }
     102
     103    eq InstGeneratedInner.getChild().myEnvironment()            = new Environment().mergeInnerClone(getGeneratedInnerModifications());
     104    eq InstGeneratedInner.getChild().myEnvironment(String name) = new Environment().mergeInnerClone(getGeneratedInnerModifications()).filter(name);
     105   
     106    syn nta List<InstModification> InstGeneratedInner.getGeneratedInnerModifications() {
     107        List<InstModification> res = new List<>();
     108        SrcModification annotation = myInnerAnnotation(name());
     109        if (annotation != null) {
     110            res.add(annotation.newInstModification());
     111        }
     112        return res;
     113    }
     114   
     115    inh SrcModification InstGeneratedInner.myInnerAnnotation(String name);
     116    eq BaseNode.getChild().myInnerAnnotation(String name) = null;
     117    eq InstClassDecl.getChild().myInnerAnnotation(String name) {
     118        AnnotationNode an = annotation().forPath("__Modelon/inners").forPath(name);
     119        if (!an.exists()) {
     120            return null;
     121        }
     122        return (SrcModification) an.ast();
     123    }
    97124
    98125    public InstGeneratedInner.InstGeneratedInner(InstClassDecl parent, InstComponentDecl outer, InstComponentDecl nonInner) {
  • branches/dev-mo-2559/Compiler/TestFramework/src/jastadd/TestCase.jrag

    r14107 r14121  
    314314        StringBuilder buf = new StringBuilder(className);
    315315        if (modification != null) {
    316             buf.append(' ');
    317316            buf.append(modification);
    318317        }
Note: See TracChangeset for help on using the changeset viewer.