(node, parsingContext)
| 32826 | return false; |
| 32827 | } |
| 32828 | function canReuseNode(node, parsingContext) { |
| 32829 | switch (parsingContext) { |
| 32830 | case 5 /* ParsingContext.ClassMembers */: |
| 32831 | return isReusableClassMember(node); |
| 32832 | case 2 /* ParsingContext.SwitchClauses */: |
| 32833 | return isReusableSwitchClause(node); |
| 32834 | case 0 /* ParsingContext.SourceElements */: |
| 32835 | case 1 /* ParsingContext.BlockStatements */: |
| 32836 | case 3 /* ParsingContext.SwitchClauseStatements */: |
| 32837 | return isReusableStatement(node); |
| 32838 | case 6 /* ParsingContext.EnumMembers */: |
| 32839 | return isReusableEnumMember(node); |
| 32840 | case 4 /* ParsingContext.TypeMembers */: |
| 32841 | return isReusableTypeMember(node); |
| 32842 | case 8 /* ParsingContext.VariableDeclarations */: |
| 32843 | return isReusableVariableDeclaration(node); |
| 32844 | case 17 /* ParsingContext.JSDocParameters */: |
| 32845 | case 16 /* ParsingContext.Parameters */: |
| 32846 | return isReusableParameter(node); |
| 32847 | // Any other lists we do not care about reusing nodes in. But feel free to add if |
| 32848 | // you can do so safely. Danger areas involve nodes that may involve speculative |
| 32849 | // parsing. If speculative parsing is involved with the node, then the range the |
| 32850 | // parser reached while looking ahead might be in the edited range (see the example |
| 32851 | // in canReuseVariableDeclaratorNode for a good case of this). |
| 32852 | // case ParsingContext.HeritageClauses: |
| 32853 | // This would probably be safe to reuse. There is no speculative parsing with |
| 32854 | // heritage clauses. |
| 32855 | // case ParsingContext.TypeParameters: |
| 32856 | // This would probably be safe to reuse. There is no speculative parsing with |
| 32857 | // type parameters. Note that that's because type *parameters* only occur in |
| 32858 | // unambiguous *type* contexts. While type *arguments* occur in very ambiguous |
| 32859 | // *expression* contexts. |
| 32860 | // case ParsingContext.TupleElementTypes: |
| 32861 | // This would probably be safe to reuse. There is no speculative parsing with |
| 32862 | // tuple types. |
| 32863 | // Technically, type argument list types are probably safe to reuse. While |
| 32864 | // speculative parsing is involved with them (since type argument lists are only |
| 32865 | // produced from speculative parsing a < as a type argument list), we only have |
| 32866 | // the types because speculative parsing succeeded. Thus, the lookahead never |
| 32867 | // went past the end of the list and rewound. |
| 32868 | // case ParsingContext.TypeArguments: |
| 32869 | // Note: these are almost certainly not safe to ever reuse. Expressions commonly |
| 32870 | // need a large amount of lookahead, and we should not reuse them as they may |
| 32871 | // have actually intersected the edit. |
| 32872 | // case ParsingContext.ArgumentExpressions: |
| 32873 | // This is not safe to reuse for the same reason as the 'AssignmentExpression' |
| 32874 | // cases. i.e. a property assignment may end with an expression, and thus might |
| 32875 | // have lookahead far beyond it's old node. |
| 32876 | // case ParsingContext.ObjectLiteralMembers: |
| 32877 | // This is probably not safe to reuse. There can be speculative parsing with |
| 32878 | // type names in a heritage clause. There can be generic names in the type |
| 32879 | // name list, and there can be left hand side expressions (which can have type |
| 32880 | // arguments.) |
| 32881 | // case ParsingContext.HeritageClauseElement: |
| 32882 | // Perhaps safe to reuse, but it's unlikely we'd see more than a dozen attributes |
| 32883 | // on any given element. Same for children. |
| 32884 | // case ParsingContext.JsxAttributes: |
| 32885 | // case ParsingContext.JsxChildren: |
no test coverage detected