Patent Document ID: 9823913
Application ID: 14957626

Base Claim:
1. A computer implemented method of detecting global variables in JAVASCRIPT code, and adding local variables in place of said global variables, comprising: receiving by a processor a JAVASCRIPT code containing at least one of a plurality of globally defined functions; generating by the processor at least one call flow graph for each one of said at least one of globally defined functions; generating by the processor an inter-procedural control flow graph for each one of said call flow graph; generating by the processor an inter-procedural dominator graph for each one of said inter-procedural control flow graph; identifying by the processor each of referenced global variables within each of said inter-procedural dominator graph and determining a JAVASCRIPT scope of each of referenced global variables; identifying by the processor at least one of: one or more confined global variables which receive a value within a first JAVASCRIPT scope of each referenced global variable wherein said value is not referenced outside of said first JAVASCRIPT scope, and one or more repeating global variables accessed repeatedly within a second JAVASCRIPT scope of each referenced global variable; and automatically adding by the processor local variables in place of at least one of said confined global variables and said repeating global variables.

---

Claim 7:
7. The method of claim 1 , further comprising identifying a definition of said referenced global variables along said inter-procedural dominator path, and identifying a scope of location of said definition, by starting from a node containing said referenced global variables and searching along paths of said inter-procedural dominator graph in a direction towards an entry node of said inter-procedural dominator graph.