Hi Leonardo,
Indeed, the MSE file you provide miss crucial information. You probably want to add some
FAMIX.Attribute for each variable.
As a first step I would only consider the “this.radius”, since it adds an attribute to the
prototype.
I advice you to do it in a step-wise fashion. Add in the MSE what you actually need.
Extracting information from the code can be a bit tedious time to time.
Cheers,
Alexandre
On Sep 26, 2014, at 3:46 PM, Alexandre Bergel <alexandre.bergel(a)me.com> wrote:
Hi!
I will try to answer you more in detail ASAP. But you are missing the notion of prototype
and attributes. A prototype may contains attributes and functions. If things are missing
in Famix, the. We can easily extend it. It is made to be expandable.
I reply to the moose mailing list since many expert in modeling will we this email.
Alexandre
Le 26-09-2014 à 19:18, Leonardo Silva
<leonardo.humberto(a)gmail.com> a écrit :
Hi Alexandre,
I've checked the JS2Moose project.
Suppose the following JS code:
function circle (radius) {
this.radius = radius;
}
circle.prototype.getArea = function () {
return (this.radius * this.radius * 3.14);
}
For this code, JS2Moose generated the following MSE:
(
(FAMIX.Function (id: 4)
(name 'window')
(staticUseStrictEnabled true)
(numberOfLinesOfCode 1)
(numberOfStatements 1))
(FAMIX.Function (id: 5)
(name 'circle')
(parentScope (ref: 4))
(staticUseStrictEnabled true)
(numberOfLinesOfCode 52)
(numberOfStatements 1))
(FAMIX.Function (id: 6)
(name '$5_27')
(parentScope (ref: 4))
(staticUseStrictEnabled true)
(numberOfLinesOfCode 60)
(numberOfStatements 1))
)
So, I am not sure this MSE has all the data we need. For example:
- "radius" is not described in the MSE
- "getArea" in the MSE is represented using another name, "$5_27"
- there is not association between getArea (id: 6) and circle (id: 5)
Of course, maybe we are doing something wrong, but it seems the MSE
does not include many important nodes that are available in a JSON file
generated by Esprima.
We can also have a skype meeting to better clarify this question.
Leonardo
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel
http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.