-
Notifications
You must be signed in to change notification settings - Fork 0
Modifcations
JavaScript module pattern technically contains the whole source code in a single statement. Therefore we cannot use the properties (a function name, variables, etc.) inside of anonymous classes / anonymous functions to use match the statement containing anonymous.
(function (global, factory) { // some 2 -3 lines definition }
(this, (function () { 'use strict';
// Main code
var x = 1;
function f1() {
}
})
)
);So in RM, the statement would contain the variable x in its list of variables. However, for JS we didn't include it.
Since the expensive String edit distance calculation runs many times during matching, we prevent this from running on a statement containing anonymous classes/ functions since it takes around 400s for 13KLOC in a single statement. For prevention -
- We did a check on LeafFragmentMapping for statements containing anonymous.
- Move anonymous class diff's code inside of findReplacementWithExactMapping() at the beginning
Issues: #80
RM does not match further after matching one pair of anonymous classes in a statement. So refactorings happening inside statements with multiple anonymous classes are not reported. Therefore we match these pairs by using the Exact and Relaxed matching where we check for function declarations similarity up to certain depths (currently 3).