Changeset 14164
- Timestamp:
- Nov 25, 2019 12:32:01 PM (11 days ago)
- Location:
- branches/dev-mo-st
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/dev-mo-st
- Property svn:mergeinfo changed
/branches/dev-mo-2559 (added) merged: 14105-14107,14121,14141
- Property svn:mergeinfo changed
-
branches/dev-mo-st/Compiler/ModelicaFrontEnd/src/jastadd/instance/InnerOuter.jrag
r13948 r14164 93 93 syn nta List<InstGeneratedInner> InstClassDecl.getInstGeneratedInners() = new List<InstGeneratedInner>(); 94 94 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().vendorNode().forPath("inners").forPath(name); 119 if (!an.exists()) { 120 return null; 121 } 122 return (SrcModification) an.ast(); 123 } 97 124 98 125 public InstGeneratedInner.InstGeneratedInner(InstClassDecl parent, InstComponentDecl outer, InstComponentDecl nonInner) { -
branches/dev-mo-st/Compiler/ModelicaFrontEnd/test/modelica/NameTests.mo
r13948 r14164 4294 4294 end OrderFile4; 4295 4295 4296 4297 model ModificationOnTest1 4298 Real x = time; 4299 4300 annotation(__JModelica(UnitTesting(tests={ 4301 FlatteningTestCase( 4302 name="ModificationOnTest1", 4303 description="Check that a modification to the test class can be added in test annotation", 4304 modification="(x=2)", 4305 flatModel=" 4306 fclass NameTests.ModificationOnTest1 4307 Real x = 2; 4308 end NameTests.ModificationOnTest1; 4309 ")}))); 4310 end ModificationOnTest1; 4311 4296 4312 end NameTests; -
branches/dev-mo-st/Compiler/TestFramework/src/jastadd/TestCase.jrag
r13396 r14164 60 60 private String sourceFileName = null; 61 61 private String className = null; 62 private String modification = null; 62 63 private int beginLine = -1; 63 64 … … 292 293 } 293 294 295 /** 296 * @return the modification 297 */ 298 public String getModification() { 299 return modification; 300 } 301 302 /** 303 * @param name the modification to set 304 */ 305 public void setModification(String modification) { 306 this.modification = modification; 307 } 308 309 /** 310 * Returns the class name with any set modification added to it, 311 * using the syntax accepted by ModelicaCompiler. 312 */ 313 public String makeClassNameWithMod() { 314 StringBuilder buf = new StringBuilder(className); 315 if (modification != null) { 316 buf.append(modification); 317 } 318 return buf.toString(); 319 } 320 294 321 /** 295 322 * @return the beginLine … … 600 627 // Instantiate and check for errors. 601 628 InstProgramRoot ipr = sr.getProgram().getInstProgramRoot(); 629 String classNameWithMod = makeClassNameWithMod(); 602 630 Collection<Problem> problems = null; 603 631 try { 604 ipr.checkErrorsInInstClass(className , checkType);632 ipr.checkErrorsInInstClass(classNameWithMod, checkType); 605 633 problems = sr.collectWarnings(); 606 634 } catch (CompilerException e) { … … 610 638 611 639 // Test instantiated class 612 InstClassDecl icd = ipr.instantiateModel( getClassName());640 InstClassDecl icd = ipr.instantiateModel(classNameWithMod); 613 641 uif.modelInstantiated(icd); 614 642 if (testInstantiated(icd)) return;
Note: See TracChangeset
for help on using the changeset viewer.