Problem during export of MSE (SourceAnchor duplicated)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Problem during export of MSE (SourceAnchor duplicated)

CyrilFerlicot
Hi,

In the latest Moose when I export a model with source anchors they are
not exported right. If I have a class referencing the sourceAnchor, the
source anchor is exported one time as an element and one time as an
attribute of the class instead of using a ref.

To explicit the problem:

testSourcesAnchorsAreNotDuplicatedAfterExport
        | model package tempFile importedModel |
        model := MooseModel new name: 'Model'.
        package := FAMIXPackage new
                name: 'Package';
                mooseModel: model;
                yourself.
        FAMIXClass new
                name: 'Class';
                container: package;
                sourceAnchor:
                        (FAMIXSourceTextAnchor new
                                source: 'some text';
                                mooseModel: model;
                                yourself);
                mooseModel: model.
        tempFile := (FileSystem memory / 'export-test.mse') ensureCreateFile.
        model exportToMSEStream: tempFile writeStream.
        importedModel := MooseModel new importFromMSEStream: tempFile readStream.
        self assert: importedModel size equals: model size

This test was added to Moose yesterday.

The change of behavior was introduced with the <container> pragma.

In the method FMRepositoryVisitor>>exportProperty:withAll:, the
sourceAnchor property is now detected as a composite and the branch used
to export the property is values do: [ :each | self exportElement: each
]. Before the introduction of the <container> pragma, the property was
not a composite and the branch executed was:

values do: [ :each |
    (self isPrimitiveTypeOrObject: each)
        ifTrue: [
            printer referenceName: each name ]
        ifFalse: [
            printer referenceNumber: (self indexOf: each) ]]

I don't know the "composite" and "container" system of FAME enough to
know how to correct this problem now.

If someone knows the importer/exporter I would appreciate help with this
one.

https://github.com/moosetechnology/Moose/issues/1198

--
Cyril Ferlicot
https://ferlicot.fr

http://www.synectique.eu
2 rue Jacques Prévert 01,
59650 Villeneuve d'ascq France


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev

signature.asc (817 bytes) Download Attachment