Skip to content

Commit a60f1fc

Browse files
committed
MPS-37113: copy attributes on migrating closures
1 parent 1539c81 commit a60f1fc

File tree

5 files changed

+151
-71
lines changed

5 files changed

+151
-71
lines changed

languages/baseLanguage/collections/languageAccessories/migration.mps

+68-1
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@
191191
<concept id="1138056143562" name="jetbrains.mps.lang.smodel.structure.SLinkAccess" flags="nn" index="3TrEf2">
192192
<reference id="1138056516764" name="link" index="3Tt5mk" />
193193
</concept>
194+
<concept id="1138056282393" name="jetbrains.mps.lang.smodel.structure.SLinkListAccess" flags="nn" index="3Tsc0h">
195+
<reference id="1138056546658" name="link" index="3TtcxE" />
196+
</concept>
194197
</language>
195198
<language id="ceab5195-25ea-4f22-9b92-103b95ca8c0c" name="jetbrains.mps.lang.core">
196199
<concept id="1133920641626" name="jetbrains.mps.lang.core.structure.BaseConcept" flags="ng" index="2VYdi">
@@ -596,7 +599,71 @@
596599
</node>
597600
</node>
598601
</node>
599-
<node concept="3clFbH" id="2OQsvxQCDYW" role="3cqZAp" />
602+
<node concept="3clFbH" id="6_W72Wf_OSH" role="3cqZAp" />
603+
<node concept="3SKdUt" id="6_W72Wf_OYN" role="3cqZAp">
604+
<node concept="1PaTwC" id="6_W72Wf_OYO" role="1aUNEU">
605+
<node concept="3oM_SD" id="6_W72Wf_PlI" role="1PaTwD">
606+
<property role="3oM_SC" value="Copy" />
607+
</node>
608+
<node concept="3oM_SD" id="6_W72Wf_PmY" role="1PaTwD">
609+
<property role="3oM_SC" value="not" />
610+
</node>
611+
<node concept="3oM_SD" id="6_W72Wf_PEK" role="1PaTwD">
612+
<property role="3oM_SC" value="needed:" />
613+
</node>
614+
<node concept="3oM_SD" id="6_W72Wf_QbQ" role="1PaTwD">
615+
<property role="3oM_SC" value="being" />
616+
</node>
617+
<node concept="3oM_SD" id="6_W72Wf_QwP" role="1PaTwD">
618+
<property role="3oM_SC" value="replaced" />
619+
</node>
620+
</node>
621+
</node>
622+
<node concept="3clFbF" id="6_W72Wf_ebb" role="3cqZAp">
623+
<node concept="2OqwBi" id="6_W72Wf_rVd" role="3clFbG">
624+
<node concept="2OqwBi" id="6_W72Wf_ePN" role="2Oq$k0">
625+
<node concept="37vLTw" id="6_W72Wf_eb9" role="2Oq$k0">
626+
<ref role="3cqZAo" node="2OQsvxQLcOd" resolve="newParam" />
627+
</node>
628+
<node concept="3Tsc0h" id="6_W72Wf_fNB" role="2OqNvi">
629+
<ref role="3TtcxE" to="tpck:4uZwTti3__2" resolve="smodelAttribute" />
630+
</node>
631+
</node>
632+
<node concept="X8dFx" id="6_W72Wf_w0K" role="2OqNvi">
633+
<node concept="2OqwBi" id="6_W72Wf_k6e" role="25WWJ7">
634+
<node concept="37vLTw" id="6_W72Wf_j2Y" role="2Oq$k0">
635+
<ref role="3cqZAo" node="6QWJOWBDarl" resolve="it" />
636+
</node>
637+
<node concept="3Tsc0h" id="6_W72Wf_kYl" role="2OqNvi">
638+
<ref role="3TtcxE" to="tpck:4uZwTti3__2" resolve="smodelAttribute" />
639+
</node>
640+
</node>
641+
</node>
642+
</node>
643+
</node>
644+
<node concept="3clFbF" id="6_W72Wf__xd" role="3cqZAp">
645+
<node concept="2OqwBi" id="6_W72Wf_EPd" role="3clFbG">
646+
<node concept="2OqwBi" id="6_W72Wf_Ady" role="2Oq$k0">
647+
<node concept="37vLTw" id="6_W72Wf__xb" role="2Oq$k0">
648+
<ref role="3cqZAo" node="2OQsvxQLcOd" resolve="newParam" />
649+
</node>
650+
<node concept="3Tsc0h" id="6_W72Wf_BrO" role="2OqNvi">
651+
<ref role="3TtcxE" to="tpee:hiAJF2X" resolve="annotation" />
652+
</node>
653+
</node>
654+
<node concept="X8dFx" id="6_W72Wf_IBX" role="2OqNvi">
655+
<node concept="2OqwBi" id="6_W72Wf_Kpp" role="25WWJ7">
656+
<node concept="37vLTw" id="6_W72Wf_Ja1" role="2Oq$k0">
657+
<ref role="3cqZAo" node="6QWJOWBDarl" resolve="it" />
658+
</node>
659+
<node concept="3Tsc0h" id="6_W72Wf_LNr" role="2OqNvi">
660+
<ref role="3TtcxE" to="tpee:hiAJF2X" resolve="annotation" />
661+
</node>
662+
</node>
663+
</node>
664+
</node>
665+
</node>
666+
<node concept="3clFbH" id="6_W72Wf_rxr" role="3cqZAp" />
600667
<node concept="3SKdUt" id="2OQsvxQCFfR" role="3cqZAp">
601668
<node concept="1PaTwC" id="2OQsvxQCFfS" role="1aUNEU">
602669
<node concept="3oM_SD" id="2OQsvxQCFxK" role="1PaTwD">
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<product version="3" modelHash="-5tap1pckzar8o3mh25a4ouxzlkyjzsn">
2+
<product version="3" modelHash="6n5fwue42i9yukqlv889pjz5g3cnu5e">
33
<files names="Language.java" />
44
</product>
55

Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<product version="3" modelHash="-9gk86eup9tr3qylcdohkwtjhsjge5q9">
2+
<product version="3" modelHash="ai2jiltau4x8xjltizmfiyyvwx68cus">
33
<files names="ConvertDeprecatedCollectionsOperations.java:DiscardSmartClosureParameterDeclaration.java:MigrationDescriptor.java" />
44
</product>
55

languages/baseLanguage/collections/source_gen/jetbrains/mps/baseLanguage/collections/migration/DiscardSmartClosureParameterDeclaration.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@
1414
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
1515
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations;
1616
import jetbrains.mps.internal.collections.runtime.ListSequence;
17+
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations;
1718
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
1819
import org.jetbrains.mps.openapi.language.SAbstractConcept;
19-
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations;
2020
import jetbrains.mps.lang.migration.runtime.base.Problem;
2121
import jetbrains.mps.lang.migration.runtime.base.NotMigratedNode;
2222
import jetbrains.mps.lang.migration.runtime.base.MigrationScriptReference;
2323
import org.jetbrains.mps.openapi.language.SConcept;
2424
import org.jetbrains.mps.openapi.language.SProperty;
25+
import org.jetbrains.mps.openapi.language.SContainmentLink;
2526
import org.jetbrains.mps.openapi.language.SReferenceLink;
2627

2728
public class DiscardSmartClosureParameterDeclaration extends MigrationScriptBase {
@@ -47,6 +48,10 @@ public void doExecute(final SModule m) {
4748
SPropertyOperations.assign(newParam, PROPS.name$MnvL, SPropertyOperations.getString(it, PROPS.name$MnvL));
4849
SPropertyOperations.assign(newParam, PROPS.isFinal$gvTP, SPropertyOperations.getBoolean(it, PROPS.isFinal$gvTP));
4950

51+
// Copy not needed: being replaced
52+
ListSequence.fromList(SLinkOperations.getChildren(newParam, LINKS.smodelAttribute$KJ43)).addSequence(ListSequence.fromList(SLinkOperations.getChildren(it, LINKS.smodelAttribute$KJ43)));
53+
ListSequence.fromList(SLinkOperations.getChildren(newParam, LINKS.annotation$K49I)).addSequence(ListSequence.fromList(SLinkOperations.getChildren(it, LINKS.annotation$K49I)));
54+
5055
// Update references
5156
ListSequence.fromList(SNodeOperations.getNodeDescendants(SNodeOperations.as(SNodeOperations.getParent(it), CONCEPTS.ClosureLiteral$rp), CONCEPTS.VariableReference$TC, false, new SAbstractConcept[]{})).where((desc) -> SLinkOperations.getTarget(desc, LINKS.variableDeclaration$N1XG) == it).visitAll((desc) -> SLinkOperations.setTarget(desc, LINKS.variableDeclaration$N1XG, newParam));
5257

@@ -87,6 +92,8 @@ private static final class PROPS {
8792
}
8893

8994
private static final class LINKS {
95+
/*package*/ static final SContainmentLink smodelAttribute$KJ43 = MetaAdapterFactory.getContainmentLink(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x10802efe25aL, 0x47bf8397520e5942L, "smodelAttribute");
96+
/*package*/ static final SContainmentLink annotation$K49I = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x114a6be947aL, 0x114a6beb0bdL, "annotation");
9097
/*package*/ static final SReferenceLink variableDeclaration$N1XG = MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c77f1e98L, 0xf8cc6bf960L, "variableDeclaration");
9198
}
9299
}

0 commit comments

Comments
 (0)