发明名称 Contextual typing
摘要 Type inference is used to provide the benefits of static type checking without explicitly declaring type in the source code. Type inference that proceeds in a bottom up direction is augmented by contextual typing that proceeds in a top down direction. Contextual typing types enclosed expressions by associating the type of a directly enclosing expression with the enclosed expression. Object literals, function literals and array literals enclosed in assignment and call expressions, can be contextually typed.
申请公布号 US9639335(B2) 申请公布日期 2017.05.02
申请号 US201313798100 申请日期 2013.03.13
申请人 MICROSOFT TECHNOLOGY LICENSING, LLC. 发明人 Hoban Lucas J.;Torgersen Mads;Jazdzewski Charles P.;Hejlsberg Anders;Lucco Steven E.;Pamer Joseph J.
分类号 G06F9/44;G06F9/45 主分类号 G06F9/44
代理机构 代理人
主权项 1. A method comprising: receiving a parse tree representing program source code by a processor of a software development computer, the program source code comprising at least one enclosing expression, the enclosing expression enclosing at least one enclosed expression; assigning a type associated with the enclosing expression to the at least one enclosed expression by: evaluating the at least one enclosing expression of the parse tree for applicability of contextual typing by: comparing the at least one enclosing expression of the parse tree with a set of templates;selecting a template from the set of templates, the selected template matching the at least one enclosing expression, the selected template associated with a process for assigning a type to the at least one enclosed expression; andassigning a type to the at least one enclosed expression by performing the process for assigning type to the at least one enclosed expression associated with the selected template in a top down direction; and providing type information for the at least one enclosed expression whose type is inferred from the type of an expression that encloses the enclosed expression on a display device.
地址 Redmond WA US