Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 34ecdf7

Browse files
committed
refactor externs generation
Summary: Split the main Annotator class into three pieces: - the code that does .ts => .ts+Closure annotations, - the code that does .ts => externs.js, - and a superclass of the code shared by both. The class hierarchy (where each level of indent means "subclass") is now: Rewriter: generic TypeScript AST rewriter - ClosureRewriter: Rewriter that understands Closure JSDoc etc. - Annotator: ClosureRewriter that does .ts => .ts+Closure - ExternsWriter: ClosureRewriter that does .tx => externs This is almost all just moving code around. The main function that changed is Annotator.annotate, to use the new classes. Should be no functionality change. Reviewers: rkirov Reviewed By: rkirov Subscribers: typescript-eng Differential Revision: https://reviews.angular.io/D209
1 parent d090fe4 commit 34ecdf7

File tree

2 files changed

+331
-312
lines changed

2 files changed

+331
-312
lines changed

src/rewriter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export abstract class Rewriter {
4242
* @return True if the node has been handled and doesn't need to be traversed;
4343
* false to have the node written and its children recursively visited.
4444
*/
45-
protected abstract maybeProcess(node: ts.Node): boolean;
45+
protected maybeProcess(node: ts.Node): boolean { return false; }
4646

4747
/** writeNode writes a ts.Node, calling this.visit() on its children. */
4848
writeNode(node: ts.Node, skipComments = false) {

0 commit comments

Comments
 (0)