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@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