-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the jsrminer wiki!
-
Javascript's default parameters can be challenging to diff since it could contain anything including a full-function declaration
-
Customized Node JS was used for faster performance (Not related to motivation but it was an added challenge)
-
Variable hoisting (the difference between let, const, var)
-
The this keyword's different behavior based on the mode (i.e. strict/nonstrict), inside function constructor or class
-
A function can be passed as parameters and treated as an object
-
closure
-
Array Access and property Access of JavaScript objects
-
There are no return types. So hard to match the signature.
Anonymous Functions
- Functions can be assigned to a variable
- Function can be declared and self invoked (without any name see issue #43)
- In Refactoring Miner Operations; the EqualSignuatre method matches UML parameters and Count and name to decide whether two anonymous classes should be mapped inside at the end of find refactoring. Also in a single statement or expression, it takes all the variables and ids inside the anonymous class into account while doing the replacement. The way JS code is written it is possible that the whole program could be inside of an anonymous function Which would provide excessive matching.
Here, we are doing equal signature as a number of parameter = number of parameter since it's unlikely that an anonymous function that appears in a single statement will be more than once. Also, we don't save the code elements such as variables, etc inside Anyonoums to the statement object.
Logic For Move Operation
-
First try matching all the removed and added operations from the list of commonly named class diff that area already matched in the model diff If something is a match they will be removed from the added/removed operations list
-
2nd Try matching all the leftover removed and added operations from the previous step and and
Move Class
In RM, MoveClass refactoring is dependent on the package rename since in Java if the class is moved to another package, the package is changed as well. This needs to be potentially customizable for other languages
in method conflictingMoveOfTopLevelClass the package name cannot be determined therefore it is turned off
- Match default parameter values in the initializer of UMLParameter Variable declarations
- Override equals, hashcode, equalsQualified, equalSignature, etc methods of UMLOperation. Basically, anything matching with the function signature should be checked.
- Any mapping assumptions where statements are always inside operation needs to be checked
- Object literal could be considered as a class or anonymous class as they can appear as part of a statement or rarely independently declared.
- In addition to Objects, Function declarations can be declared anywhere. If it's part of a statement, it could be an anonymous function. Of it's independent we have to match them
- In JS, statements have an optional semicolon at the end, unlike java. So functionBodymapper code needs to be checked for such assumptions.
- Checking the code inside PrefixUtils & assignmentInvocationCoveringEntireStatement since In java the AST visitor seems like returning the node string without any spacing, for example, int x = 5; is returned as x=5; In JS the text is returned as x = 5 with proper spacing between after and before the assignment.
-containsMethodSignatureOfAnonymousClass
- JsConfig.METHOD_SIGNATURE_PATTERN
- Invocation's string matching codes
- Heuristics makeReplacementWithTernaryOnTheLeft
- CheckForMovedClasses - This needs to be revisited
- ReplacementUtil's replacement of checking valid characters (e.g. template string literal in js)
return `_o(${genElement(el, state)},${state.onceId++},${key})`
Limitations parsing