There is a vast gap in the quality of IDE tooling between static languages like Java and dynamic languages like Python or JavaScript. Modern frameworks and libraries in these languages heavily use their dynamic capabilities to achieve the best ergonomics and readability. This has a side effect of making the current generation of IDEs blind to control flow and data flow, which often breaks navigation, autocompletion and refactoring. In this thesis we propose an algorithm that can bridge this gap between tooling for dynamic and static languages by statically analyzing dynamic metaprogramming and runtime reflection in programs. We use a technique called abstract interpretation to partially execute programs and extract information that is usually only available at runtime. Our algorithm has been implemented in a prototype analyzer that can analyze programs written in a subset of JavaScript.
翻译:在静态语言(如Java)与动态语言(如Python或JavaScript)之间,IDE工具链的质量存在巨大差距。这些语言中的现代框架和库广泛利用其动态特性以达到最佳的人机工效性和可读性。然而,这种特性导致当前一代IDE对控制流与数据流分析能力不足,进而常使导航、自动补全和重构功能失效。本文提出一种算法,通过静态分析程序中的动态元编程和运行时反射机制,弥合动态语言与静态语言工具链之间的鸿沟。我们采用名为抽象解释的技术对程序进行部分执行,从而提取通常仅在运行时可获得的信息。该算法已在原型分析器中实现,可分析JavaScript子集编写的程序。