Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
c3faf0f
Added visitor API
rbuckton Feb 4, 2016
3855261
removed unused function
rbuckton Feb 4, 2016
cadda66
Adds transform flags aggregation to binder and visitor
rbuckton Feb 4, 2016
f8e574f
Added ArrayKind, moved createNode, changed JSDocParsing tests to use …
rbuckton Feb 4, 2016
8bf176a
Cleanup and reorganization of node tests
rbuckton Feb 5, 2016
ba9181c
Merge branch 'transforms-visitor' into transforms-flags
rbuckton Feb 5, 2016
1e35593
Adds the transformFiles API
rbuckton Feb 5, 2016
b3e9d26
Moved createNode back to parser, added local createNode to factory
rbuckton Feb 8, 2016
34489a4
Merge branch 'transforms-visitor' into transforms-flags
rbuckton Feb 8, 2016
cbb910a
Merge branch 'transforms-flags' into transforms-transformer
rbuckton Feb 8, 2016
af24b16
PR Feedback
rbuckton Feb 9, 2016
1a0b877
Merge branch 'transforms-visitor' into transforms-flags
rbuckton Feb 9, 2016
51dd27a
Moved TreansformFlags assertions after markers
rbuckton Feb 9, 2016
6fa4002
Merge branch 'transforms-flags' into transforms-transformer
rbuckton Feb 9, 2016
0f2bbb1
Moved LexicalEnvironment to types.ts, minor fixes
rbuckton Feb 9, 2016
6b381ec
Added printer
rbuckton Feb 9, 2016
fb19e81
Fixed linter error
rbuckton Feb 9, 2016
e545f1b
Merge branch 'transforms-transformer' into transforms-printer
rbuckton Feb 9, 2016
49d2d93
Adds destructuring logic and placeholders for each transformer.
rbuckton Feb 9, 2016
f948b14
Adds the TypeScript transformer
rbuckton Feb 12, 2016
387b30c
Some cleanup and reorganization
rbuckton Feb 12, 2016
4577441
Merge branch 'transforms-visitor' into transforms-flags
rbuckton Feb 12, 2016
319ff61
PR Feedback
rbuckton Feb 12, 2016
ceae78b
Merge branch 'transforms-flags' into transforms-transformer
rbuckton Feb 12, 2016
f8ed021
PR feedback and cleanup
rbuckton Feb 13, 2016
ab811f9
Updates to TransformationContext and transformer.ts
rbuckton Feb 13, 2016
c634a36
Merge branch 'transforms-transformer' into transforms-printer
rbuckton Feb 13, 2016
0f16e68
PR Feedback
rbuckton Feb 17, 2016
8ec3932
Merge branch 'transforms-transformer' into transforms-printer
rbuckton Feb 17, 2016
357171f
PR feedback, switched to getEmitScriptTarget/getEmitModuleKind
rbuckton Feb 17, 2016
c4dc2ae
Merge branch 'transforms-transformer' into transforms-transformer-ts
rbuckton Feb 17, 2016
6c0551f
Adds initial jsx transformer
rbuckton Feb 17, 2016
1ceb02a
Added initial ES7 transformer
rbuckton Feb 17, 2016
dd2dc78
Enables source maps for exceptions thrown in the compiler (when avail…
rbuckton Feb 20, 2016
c759b63
Adds ES6 transformer
rbuckton Feb 20, 2016
39628d7
Added CommonJS/AMD/UMD module transformer
rbuckton Feb 20, 2016
5564537
Added initial SystemJS transformer.
rbuckton Feb 22, 2016
ad64877
Merged some changes from other branches.
rbuckton Feb 22, 2016
ab8e83e
Merge branch 'transforms-visitor' into transforms-flags
rbuckton Feb 22, 2016
cd7c229
Merged some changes from other branches.
rbuckton Feb 22, 2016
024eff1
Merge branch 'transforms-flags' into transforms-transformer
rbuckton Feb 22, 2016
11d54ba
Merged some changes from other branches.
rbuckton Feb 22, 2016
2ab8877
Fix for new linter warning
rbuckton Feb 22, 2016
8e0d28e
Merge branch 'transforms-flags' into transforms-transformer
rbuckton Feb 22, 2016
80f89a1
PR feedback
rbuckton Feb 22, 2016
7d72c18
Merge branch 'transforms-flags' into transforms-transformer
rbuckton Feb 22, 2016
90a317f
Merge branch 'transforms-transformer' into transforms-printer
rbuckton Feb 22, 2016
6d27336
Merged some changes from other branches.
rbuckton Feb 23, 2016
f52a30b
Merged some changes from other branches.
rbuckton Feb 23, 2016
efa5353
Fix new linter warning.
rbuckton Feb 23, 2016
64e7aa8
PR Feedback.
rbuckton Feb 23, 2016
0a325ee
Merge branch 'transforms-printer' into transforms-transformer-ts
rbuckton Feb 23, 2016
3d8cb51
Merge branch 'transforms-transformer-ts' into transforms-transformer-jsx
rbuckton Feb 23, 2016
0145009
Merge branch 'transforms-transformer-jsx' into transforms-transformer…
rbuckton Feb 23, 2016
dc0b043
Merge branch 'transforms-transformer-es7' into transforms-transformer…
rbuckton Feb 23, 2016
0b64048
Merge branch 'transforms-transformer-es6' into transforms-transformer…
rbuckton Feb 23, 2016
f3179da
Fixed issue with test dependencies
rbuckton Feb 23, 2016
617e511
Merge branch 'transforms-transformer' into transforms-printer
rbuckton Feb 23, 2016
61fe61b
Merge branch 'transforms-printer' into transforms-transformer-ts
rbuckton Feb 23, 2016
c166a2d
Merge branch 'transforms-transformer-ts' into transforms-transformer-jsx
rbuckton Feb 23, 2016
5b7bd63
Merge branch 'transforms-transformer-jsx' into transforms-transformer…
rbuckton Feb 23, 2016
6d111e3
Merge branch 'transforms-transformer-es7' into transforms-transformer…
rbuckton Feb 23, 2016
4a81dde
Fixed issue with smartindenter
rbuckton Feb 23, 2016
2e47e2e
Merge branch 'transforms-transformer' into transforms-printer
rbuckton Feb 23, 2016
e5cd8fe
Added temporary compat flag to control emit output to fix tests
rbuckton Feb 23, 2016
b3adade
PR Feedback
rbuckton Feb 23, 2016
61f3ba6
Merge branch 'transforms-transformer' into transforms-printer
rbuckton Feb 23, 2016
ad314b0
Merge branch 'transforms-printer' into transforms-transformer-ts
rbuckton Feb 23, 2016
0937cec
Added additional auto-parenthesizing to visitor.
rbuckton Feb 23, 2016
98ab964
Merge branch 'transforms-transformer' into transforms-printer
rbuckton Feb 23, 2016
52c62d0
Merge branch 'transforms-printer' into transforms-transformer-ts
rbuckton Feb 23, 2016
f484ff4
Reenabled transforms.
rbuckton Feb 23, 2016
635347e
Fixed typo in visitEachChild
rbuckton Feb 23, 2016
9871d3b
Merge branch 'transforms-transformer' into transforms-printer
rbuckton Feb 23, 2016
de9866f
Merge branch 'transforms-printer' into transforms-transformer-ts
rbuckton Feb 23, 2016
02b85f8
PR feedback
rbuckton Feb 23, 2016
f92c24b
Removed unused liftNode function
rbuckton Feb 23, 2016
40b61fb
Merge branch 'transforms-transformer' into transforms-printer
rbuckton Feb 23, 2016
4f03b31
Updated lift behavior
rbuckton Feb 23, 2016
75b2181
Merge branch 'transforms-transformer' into transforms-printer
rbuckton Feb 23, 2016
951ce55
Merge branch 'transforms-printer' into transforms-transformer-ts
rbuckton Feb 23, 2016
08036b7
Fixed linter warnings, added comments and minor cleanup.
rbuckton Feb 24, 2016
608822d
Merge branch 'transforms-transformer-ts' into transforms-transformer-jsx
rbuckton Feb 24, 2016
c9f5253
Fixed linter warnings
rbuckton Feb 24, 2016
25f4102
Reverted change to emitter to force use of printFiles
rbuckton Feb 24, 2016
cde3b34
Merge branch 'transforms-transformer-ts' into transforms-transformer-jsx
rbuckton Feb 24, 2016
5a9b131
Merge branch 'transforms-transformer-jsx' into transforms-transformer…
rbuckton Feb 24, 2016
78dfab8
Merge branch 'transforms-transformer-es7' into transforms-transformer…
rbuckton Feb 24, 2016
0d8e152
Merge branch 'transforms-transformer-es6' into transforms-transformer…
rbuckton Feb 24, 2016
72bfd2f
Fixed linter warnings.
rbuckton Feb 24, 2016
cd2cf7d
PR Feedback and defer makeUniqueName/getGeneratedNameForNode to printer.
rbuckton Feb 29, 2016
b1d8828
Remove transformCompatibleEmit flag and make it the default.
rbuckton Feb 29, 2016
8e5e5f8
Merge branch 'transforms-printer' into transforms-transformer-ts
rbuckton Feb 29, 2016
359875b
PR Feedback
rbuckton Feb 29, 2016
fe7ad5f
Minor tweaks to naming
rbuckton Feb 29, 2016
a0dbe76
PR Feedback
rbuckton Mar 1, 2016
a7f9cda
Merge branch 'transforms-transformer-ts' into transforms-transformer-jsx
rbuckton Mar 1, 2016
7d05ba2
Fixed visitJsxText, plus PR Feedback
rbuckton Mar 1, 2016
186f5c8
PR Feedback
rbuckton Mar 1, 2016
2c9cd2e
Merge branch 'transforms-transformer-jsx' into transforms-transformer…
rbuckton Mar 1, 2016
88e1772
Merge branch 'transforms-transformer-es7' into transforms-transformer…
rbuckton Mar 1, 2016
30433c2
ES6 cleanup
rbuckton Mar 2, 2016
2d2709f
Fixed typo in visitCallExpression
rbuckton Mar 2, 2016
70cbb9b
Merge branch 'transforms-transformer-es6' into transforms-transformer…
rbuckton Mar 2, 2016
ebb4764
Switch from onBefore/onAfterEmitNode to onEmitNode
rbuckton Mar 2, 2016
e66e51d
Merge branch 'transforms-printer' into transforms-transformer-ts
rbuckton Mar 2, 2016
8b35af4
Switched to onEmitNode
rbuckton Mar 2, 2016
1fdaf74
Merge branch 'transforms-transformer-ts' into transforms-transformer-jsx
rbuckton Mar 2, 2016
593fbd4
Merge branch 'transforms-transformer-jsx' into transforms-transformer…
rbuckton Mar 2, 2016
7b28b48
Merge branch 'transforms-transformer-es7' into transforms-transformer…
rbuckton Mar 2, 2016
1c73818
Switched to onEmitNode
rbuckton Mar 2, 2016
c4a75ba
Merge branch 'transforms-transformer-es6' into transforms-transformer…
rbuckton Mar 2, 2016
72eebdb
Switched to onEmitNode
rbuckton Mar 2, 2016
1cf183b
Fixed invalid assertion in ts transformer
rbuckton Mar 4, 2016
d89e21a
General fixes and cleanup
rbuckton Mar 8, 2016
5b8cf96
Moved modifier related flags to separate enum
rbuckton Mar 10, 2016
99e6ad8
Removed ModifiersArray
rbuckton Mar 10, 2016
47cdfbe
Add support for array return values from visitors
rbuckton Mar 10, 2016
2699bf9
Removed NodeArrayNode in favor of arrays
rbuckton Mar 10, 2016
94018a1
cleaned up assertions and removed flattenNodes.
rbuckton Mar 10, 2016
ad0dd4e
Fixed perf issue in binder, plus PR feedback
rbuckton Mar 18, 2016
44ca7d4
Updated baselines
rbuckton Mar 18, 2016
ae7843d
PR Feedback
rbuckton Mar 18, 2016
3c5f170
Merge pull request #7206 from Microsoft/transforms-transformer-module
rbuckton Mar 18, 2016
07a3d18
Merge pull request #7194 from Microsoft/transforms-transformer-es6
rbuckton Mar 18, 2016
cc00f4c
Merge pull request #7193 from Microsoft/transforms-transformer-es7
rbuckton Mar 18, 2016
829a9df
Merge pull request #7192 from Microsoft/transforms-transformer-jsx
rbuckton Mar 18, 2016
ca9148e
Merge pull request #7191 from Microsoft/transforms-transformer-ts
rbuckton Mar 18, 2016
85ae53d
Merge pull request #6987 from Microsoft/transforms-printer
rbuckton Mar 18, 2016
a212e2b
Merge pull request #6986 from Microsoft/transforms-transformer
rbuckton Mar 18, 2016
f9cb493
Merge pull request #6983 from Microsoft/transforms-flags
rbuckton Mar 18, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cleaned up assertions and removed flattenNodes.
  • Loading branch information
rbuckton committed Mar 10, 2016
commit 94018a13e6900981ece892727e35f20a9f19d88d
18 changes: 17 additions & 1 deletion src/compiler/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,12 @@ namespace ts {
}

export namespace Debug {
const currentAssertionLevel = AssertionLevel.None;
declare var process: any;
declare var require: any;

const currentAssertionLevel = getDevelopmentMode() === "development"
? AssertionLevel.Normal
: AssertionLevel.None;

export function shouldAssert(level: AssertionLevel): boolean {
return currentAssertionLevel >= level;
Expand All @@ -1055,6 +1060,17 @@ namespace ts {
export function fail(message?: string): void {
Debug.assert(/*expression*/ false, message);
}

function getDevelopmentMode() {
return typeof require !== "undefined"
&& typeof process !== "undefined"
&& !process.browser
&& process.nextTick
&& process.env
&& process.env.NODE_ENV
? String(process.env.NODE_ENV).toLowerCase()
: undefined;
}
}

export function copyListRemovingItem<T>(item: T, list: T[]) {
Expand Down
10 changes: 5 additions & 5 deletions src/compiler/transformers/destructuring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace ts {
node: BinaryExpression,
needsValue: boolean,
recordTempVariable: (node: Identifier) => void,
visitor?: (node: Node) => OneOrMany<Node>) {
visitor?: (node: Node) => VisitResult<Node>) {

if (isEmptyObjectLiteralOrArrayLiteral(node.left)) {
return node.right;
Expand Down Expand Up @@ -79,7 +79,7 @@ namespace ts {
* @param value The rhs value for the binding pattern.
* @param visitor An optional visitor to use to visit expressions.
*/
export function flattenParameterDestructuring(node: ParameterDeclaration, value: Expression, visitor?: (node: Node) => OneOrMany<Node>) {
export function flattenParameterDestructuring(node: ParameterDeclaration, value: Expression, visitor?: (node: Node) => VisitResult<Node>) {
const declarations: VariableDeclaration[] = [];

flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, visitor);
Expand Down Expand Up @@ -110,7 +110,7 @@ namespace ts {
* @param value An optional rhs value for the binding pattern.
* @param visitor An optional visitor to use to visit expressions.
*/
export function flattenVariableDestructuring(node: VariableDeclaration, value?: Expression, visitor?: (node: Node) => OneOrMany<Node>) {
export function flattenVariableDestructuring(node: VariableDeclaration, value?: Expression, visitor?: (node: Node) => VisitResult<Node>) {
const declarations: VariableDeclaration[] = [];

flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, visitor);
Expand Down Expand Up @@ -151,7 +151,7 @@ namespace ts {
node: VariableDeclaration,
recordTempVariable: (name: Identifier) => void,
nameSubstitution?: (name: Identifier) => Expression,
visitor?: (node: Node) => OneOrMany<Node>) {
visitor?: (node: Node) => VisitResult<Node>) {

const pendingAssignments: Expression[] = [];

Expand Down Expand Up @@ -191,7 +191,7 @@ namespace ts {
location: TextRange,
emitAssignment: (name: Identifier, value: Expression, location: TextRange, original: Node) => void,
emitTempVariableAssignment: (value: Expression, location: TextRange) => Identifier,
visitor?: (node: Node) => OneOrMany<Node>) {
visitor?: (node: Node) => VisitResult<Node>) {
if (value && visitor) {
value = visitNode(value, visitor, isExpression);
}
Expand Down
19 changes: 11 additions & 8 deletions src/compiler/transformers/es6.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace ts {
return visitEachChild(node, visitor, context);
}

function visitor(node: Node): OneOrMany<Node> {
function visitor(node: Node): VisitResult<Node> {
const savedContainingNonArrowFunction = containingNonArrowFunction;
const savedCurrentParent = currentParent;
const savedCurrentNode = currentNode;
Expand All @@ -74,7 +74,7 @@ namespace ts {
return visited;
}

function visitorWorker(node: Node): OneOrMany<Node> {
function visitorWorker(node: Node): VisitResult<Node> {
if (node.transformFlags & TransformFlags.ES6) {
return visitJavaScript(node);
}
Expand All @@ -86,7 +86,7 @@ namespace ts {
}
}

function visitJavaScript(node: Node): OneOrMany<Node> {
function visitJavaScript(node: Node): VisitResult<Node> {
switch (node.kind) {
case SyntaxKind.ClassDeclaration:
return visitClassDeclaration(<ClassDeclaration>node);
Expand Down Expand Up @@ -174,9 +174,12 @@ namespace ts {

case SyntaxKind.SourceFile:
return visitSourceFileNode(<SourceFile>node);

default:
Debug.failBadSyntaxKind(node);
return visitEachChild(node, visitor, context);
}

Debug.fail(`Unexpected node kind: ${formatSyntaxKind(node.kind)}.`);
}

function onBeforeVisitNode(node: Node) {
Expand Down Expand Up @@ -695,7 +698,7 @@ namespace ts {
break;

default:
Debug.fail(`Unexpected node kind: ${formatSyntaxKind(node.kind)}.`);
Debug.failBadSyntaxKind(node);
break;
}
}
Expand Down Expand Up @@ -936,7 +939,7 @@ namespace ts {
enableSubstitutionsForBlockScopedBindings();
return setOriginalNode(
createVariableDeclarationList(
flattenNodes(map(node.declarations, visitVariableDeclarationInLetDeclarationList)),
flatten(map(node.declarations, visitVariableDeclarationInLetDeclarationList)),
/*location*/ node
),
node
Expand Down Expand Up @@ -1043,7 +1046,7 @@ namespace ts {
*
* @param node A VariableDeclaration node.
*/
function visitVariableDeclaration(node: VariableDeclaration): OneOrMany<VariableDeclaration> {
function visitVariableDeclaration(node: VariableDeclaration): VisitResult<VariableDeclaration> {
// If we are here it is because the name contains a binding pattern.
Debug.assert(isBindingPattern(node.name));

Expand Down Expand Up @@ -1293,7 +1296,7 @@ namespace ts {
break;

default:
Debug.fail(`Unexpected node kind: ${formatSyntaxKind(node.kind)}.`);
Debug.failBadSyntaxKind(node);
break;
}
}
Expand Down
13 changes: 8 additions & 5 deletions src/compiler/transformers/es7.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace ts {
return visitEachChild(node, visitor, context);
}

function visitor(node: Node): OneOrMany<Node> {
function visitor(node: Node): VisitResult<Node> {
if (node.transformFlags & TransformFlags.ES7) {
return visitorWorker(node);
}
Expand All @@ -24,13 +24,15 @@ namespace ts {
}
}

function visitorWorker(node: Node): OneOrMany<Node> {
function visitorWorker(node: Node): VisitResult<Node> {
switch (node.kind) {
case SyntaxKind.BinaryExpression:
return visitBinaryExpression(<BinaryExpression>node);
}

Debug.fail(`Unexpected node kind: ${formatSyntaxKind(node.kind)}.`);
default:
Debug.failBadSyntaxKind(node);
return visitEachChild(node, visitor, context);
}
}

function visitBinaryExpression(node: BinaryExpression): Expression {
Expand Down Expand Up @@ -90,7 +92,8 @@ namespace ts {
return createMathPow(left, right, /*location*/ node);
}
else {
Debug.fail(`Unexpected operator kind: ${formatSyntaxKind(node.operatorToken.kind)}.`);
Debug.failBadSyntaxKind(node);
return visitEachChild(node, visitor, context);
}
}
}
Expand Down
16 changes: 10 additions & 6 deletions src/compiler/transformers/jsx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace ts {
return visitEachChild(node, visitor, context);
}

function visitor(node: Node): OneOrMany<Node> {
function visitor(node: Node): VisitResult<Node> {
if (node.transformFlags & TransformFlags.Jsx) {
return visitorWorker(node);
}
Expand All @@ -30,16 +30,18 @@ namespace ts {
}
}

function visitorWorker(node: Node): OneOrMany<Node> {
function visitorWorker(node: Node): VisitResult<Node> {
switch (node.kind) {
case SyntaxKind.JsxElement:
return visitJsxElement(<JsxElement>node);

case SyntaxKind.JsxSelfClosingElement:
return visitJsxSelfClosingElement(<JsxSelfClosingElement>node);
}

Debug.fail(`Unexpected node kind: ${formatSyntaxKind(node.kind)}.`);
default:
Debug.failBadSyntaxKind(node);
return undefined;
}
}

function transformJsxChildToExpression(node: JsxChild): Expression {
Expand All @@ -55,9 +57,11 @@ namespace ts {

case SyntaxKind.JsxSelfClosingElement:
return visitJsxSelfClosingElement(<JsxSelfClosingElement>node);
}

Debug.fail(`Unexpected node kind: ${formatSyntaxKind(node.kind)}.`);
default:
Debug.failBadSyntaxKind(node);
return undefined;
}
}

function visitJsxElement(node: JsxElement) {
Expand Down
20 changes: 10 additions & 10 deletions src/compiler/transformers/module/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ namespace ts {
createStatement(
createCall(
define,
flattenNodes([
flatten([
// Add the module name (if provided).
moduleName,

Expand All @@ -142,7 +142,7 @@ namespace ts {
setNodeEmitFlags(
setMultiLine(
createBlock(
flattenNodes([
flatten([
// Visit each statement of the module body.
...visitNodes(node.statements, visitor, isStatement),

Expand Down Expand Up @@ -173,7 +173,7 @@ namespace ts {
*
* @param node The node.
*/
function visitor(node: Node): OneOrMany<Node> {
function visitor(node: Node): VisitResult<Node> {
switch (node.kind) {
case SyntaxKind.ImportDeclaration:
return visitImportDeclaration(<ImportDeclaration>node);
Expand Down Expand Up @@ -208,7 +208,7 @@ namespace ts {
*
* @param node The ImportDeclaration node.
*/
function visitImportDeclaration(node: ImportDeclaration): OneOrMany<Statement> {
function visitImportDeclaration(node: ImportDeclaration): VisitResult<Statement> {
if (contains(externalImports, node)) {
const statements: Statement[] = [];
const namespaceDeclaration = getNamespaceDeclarationNode(node);
Expand Down Expand Up @@ -287,7 +287,7 @@ namespace ts {
return undefined;
}

function visitImportEqualsDeclaration(node: ImportEqualsDeclaration): OneOrMany<Statement> {
function visitImportEqualsDeclaration(node: ImportEqualsDeclaration): VisitResult<Statement> {
if (contains(externalImports, node)) {
const statements: Statement[] = [];
if (moduleKind !== ModuleKind.AMD) {
Expand Down Expand Up @@ -335,7 +335,7 @@ namespace ts {
return undefined;
}

function visitExportDeclaration(node: ExportDeclaration): OneOrMany<Statement> {
function visitExportDeclaration(node: ExportDeclaration): VisitResult<Statement> {
if (contains(externalImports, node)) {
const generatedName = getGeneratedNameForNode(node);
if (node.exportClause) {
Expand Down Expand Up @@ -391,7 +391,7 @@ namespace ts {
return undefined;
}

function visitExportAssignment(node: ExportAssignment): OneOrMany<Statement> {
function visitExportAssignment(node: ExportAssignment): VisitResult<Statement> {
if (!node.isExportEquals && resolver.isValueAliasDeclaration(node)) {
const statements: Statement[] = [];
addExportDefault(statements, node.expression, /*location*/ node);
Expand Down Expand Up @@ -470,7 +470,7 @@ namespace ts {
}
}

function visitVariableStatement(node: VariableStatement): OneOrMany<Statement> {
function visitVariableStatement(node: VariableStatement): VisitResult<Statement> {
const variables = getInitializedVariables(node.declarationList);
if (variables.length === 0) {
// elide statement if there are no initialized variables
Expand Down Expand Up @@ -502,7 +502,7 @@ namespace ts {
}
}

function visitFunctionDeclaration(node: FunctionDeclaration): OneOrMany<Statement> {
function visitFunctionDeclaration(node: FunctionDeclaration): VisitResult<Statement> {
const statements: Statement[] = [];
if (node.name) {
if (hasModifier(node, ModifierFlags.Export)) {
Expand Down Expand Up @@ -543,7 +543,7 @@ namespace ts {
return statements;
}

function visitClassDeclaration(node: ClassDeclaration): OneOrMany<Statement> {
function visitClassDeclaration(node: ClassDeclaration): VisitResult<Statement> {
const statements: Statement[] = [];
if (node.name) {
if (hasModifier(node, ModifierFlags.Export)) {
Expand Down
10 changes: 5 additions & 5 deletions src/compiler/transformers/module/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ namespace ts {
return createArrayLiteral(setters);
}

function visitSourceElement(node: Node): OneOrMany<Node> {
function visitSourceElement(node: Node): VisitResult<Node> {
switch (node.kind) {
case SyntaxKind.ImportDeclaration:
return visitImportDeclaration(<ImportDeclaration>node);
Expand All @@ -427,7 +427,7 @@ namespace ts {
}
}

function visitNestedNode(node: Node): OneOrMany<Node> {
function visitNestedNode(node: Node): VisitResult<Node> {
switch (node.kind) {
case SyntaxKind.VariableStatement:
return visitVariableStatement(<VariableStatement>node);
Expand Down Expand Up @@ -502,7 +502,7 @@ namespace ts {
return undefined;
}

function visitExportDeclaration(node: ExportDeclaration): OneOrMany<Statement> {
function visitExportDeclaration(node: ExportDeclaration): VisitResult<Statement> {
if (!node.moduleSpecifier) {
const statements: Statement[] = [];
addNodes(statements, map(node.exportClause.elements, visitExportSpecifier));
Expand Down Expand Up @@ -541,7 +541,7 @@ namespace ts {
*
* @param node The variable statement to visit.
*/
function visitVariableStatement(node: VariableStatement): OneOrMany<Statement> {
function visitVariableStatement(node: VariableStatement): VisitResult<Statement> {
const isExported = hasModifier(node, ModifierFlags.Export);
const expressions: Expression[] = [];
for (const variable of node.declarationList.declarations) {
Expand Down Expand Up @@ -616,7 +616,7 @@ namespace ts {
*
* @param node The class declaration to visit.
*/
function visitClassDeclaration(node: ClassDeclaration): OneOrMany<Statement> {
function visitClassDeclaration(node: ClassDeclaration): VisitResult<Statement> {
// Hoist the name of the class declaration to the outer module body function.
const name = getDeclarationName(node);
hoistVariableDeclaration(name);
Expand Down
Loading