Resolve "Feature: Add context-free connect"
Closes #34 (closed)
Edited by René Schöne
Merge request reports
Activity
changed milestone to %1.0.0
added Component: Backend Component: Frontend labels
assigned to @rschoene
Manual version of aspect to be generated:
// to be generated aspect ToBeGeneratedShared { inh ASTNode A.myParent(); eq Root.getA().myParent() = this; eq Root.getSingleA().myParent() = this; eq Root.getOptA().myParent() = this; eq Root.getListA().myParent() = this; uncache A.myIndexInList(); inh int A.myIndexInList(); eq Root.getA().myIndexInList() = -1; eq Root.getSingleA().myIndexInList() = -1; eq Root.getOptA().myIndexInList() = -1; eq Root.getListA(int i).myIndexInList() = i; } aspect ToBeGeneratedVersion1 { inh String A.myContext(); eq Root.getA().myContext() = "A"; eq Root.getSingleA().myContext() = "SingleA"; eq Root.getOptA().myContext() = "OptA"; eq Root.getListA().myContext() = "ListA"; inh String A.myParentName(); eq Root.getA().myParentName() = "Root"; eq Root.getSingleA().myParentName() = "Root"; eq Root.getOptA().myParentName() = "Root"; eq Root.getListA().myParentName() = "Root"; public boolean A.myConnect(String uri) throws java.io.IOException { switch (myParentName()) { case "Root": switch (myContext()) { case "A": return ((Root) myParent()).connectA(uri); case "SingleA": return ((Root) myParent()).connectSingleA(uri); case "OptA": return ((Root) myParent()).connectOptA(uri); case "ListA": return ((Root) myParent()).connectListA(uri, myIndexInList()); default: System.err.println("No matching context for " + this + " in Root"); return false; } default: System.err.println("No matching parent for " + this); return false; } } } aspect ToBeGeneratedVersion2 { uncache A.alternative_myContext(); inh String A.alternative_myContext(); eq Root.getA().alternative_myContext() = "Root.A"; eq Root.getSingleA().alternative_myContext() = "Root.SingleA"; eq Root.getOptA().alternative_myContext() = "Root.OptA"; eq Root.getListA().alternative_myContext() = "Root.ListA"; public boolean A.alternative_myConnect(String uri) throws java.io.IOException { switch (alternative_myContext()) { case "Root.A": return ((Root) myParent()).connectA(uri); case "Root.SingleA": return ((Root) myParent()).connectSingleA(uri); case "Root.OptA": return ((Root) myParent()).connectOptA(uri); case "Root.ListA": return ((Root) myParent()).connectListA(uri, myIndexInList()); default: System.err.println("No matching context while connecting " + this + " to " + uri); return false; } } public boolean A.alternative_myDisconnect(String uri) throws java.io.IOException { switch (alternative_myContext()) { case "Root.A": return ((Root) myParent()).disconnectA(uri); case "Root.SingleA": return ((Root) myParent()).disconnectSingleA(uri); case "Root.OptA": return ((Root) myParent()).disconnectOptA(uri); case "Root.ListA": return ((Root) myParent()).disconnectListA(uri); default: System.err.println("No matching context while disconnecting for " + this + " from " + uri); return false; } } }
enabled an automatic merge when the pipeline for 40f351b8 succeeds
mentioned in commit 1fedb9cf
Please register or sign in to reply