Skip to content

Commit c958c47

Browse files
author
Andy Hanson
committed
Merge branch 'master' into map4
2 parents a118382 + 8ad68ad commit c958c47

File tree

127 files changed

+3974
-615
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+3974
-615
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ matrix:
1515
branches:
1616
only:
1717
- master
18-
- release-2.0
18+
- release-2.1
1919

2020
install:
2121
- npm uninstall typescript

jenkins.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
# Set up NVM
4+
export NVM_DIR="/home/dotnet-bot/.nvm"
5+
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
6+
7+
nvm install $1
8+
9+
npm uninstall typescript
10+
npm uninstall tslint
11+
npm install
12+
npm update
13+
npm test

netci.groovy

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Import the utility functionality.
2+
import jobs.generation.Utilities;
3+
4+
// Defines a the new of the repo, used elsewhere in the file
5+
def project = GithubProject
6+
def branch = GithubBranchName
7+
8+
def nodeVersions = ['stable', '4']
9+
10+
nodeVersions.each { nodeVer ->
11+
12+
def newJobName = "typescript_node.${nodeVer}"
13+
def newJob = job(Utilities.getFullJobName(project, newJobName, true)) {
14+
steps {
15+
shell("./jenkins.sh ${nodeVer}")
16+
}
17+
}
18+
19+
Utilities.standardJobSetup(newJob, project, true, "*/${branch}")
20+
Utilities.setMachineAffinity(newJob, 'Ubuntu', '20161020')
21+
Utilities.addGithubPRTriggerForBranch(newJob, branch, "TypeScript Test Run ${newJobName}")
22+
}

src/compiler/binder.ts

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ namespace ts {
5454
const body = (<ModuleDeclaration>node).body;
5555
return body ? getModuleInstanceState(body) : ModuleInstanceState.Instantiated;
5656
}
57+
// Only jsdoc typedef definition can exist in jsdoc namespace, and it should
58+
// be considered the same as type alias
59+
else if (node.kind === SyntaxKind.Identifier && (<Identifier>node).isInJSDocNamespace) {
60+
return ModuleInstanceState.NonInstantiated;
61+
}
5762
else {
5863
return ModuleInstanceState.Instantiated;
5964
}
@@ -429,7 +434,11 @@ namespace ts {
429434
// during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation
430435
// and this case is specially handled. Module augmentations should only be merged with original module definition
431436
// and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed.
432-
if (!isAmbientModule(node) && (hasExportModifier || container.flags & NodeFlags.ExportContext)) {
437+
const isJSDocTypedefInJSDocNamespace = node.kind === SyntaxKind.JSDocTypedefTag &&
438+
node.name &&
439+
node.name.kind === SyntaxKind.Identifier &&
440+
(<Identifier>node.name).isInJSDocNamespace;
441+
if ((!isAmbientModule(node) && (hasExportModifier || container.flags & NodeFlags.ExportContext)) || isJSDocTypedefInJSDocNamespace) {
433442
const exportKind =
434443
(symbolFlags & SymbolFlags.Value ? SymbolFlags.ExportValue : 0) |
435444
(symbolFlags & SymbolFlags.Type ? SymbolFlags.ExportType : 0) |
@@ -1007,7 +1016,7 @@ namespace ts {
10071016
currentFlow = finishFlowLabel(preFinallyLabel);
10081017
bind(node.finallyBlock);
10091018
// if flow after finally is unreachable - keep it
1010-
// otherwise check if flows after try and after catch are unreachable
1019+
// otherwise check if flows after try and after catch are unreachable
10111020
// if yes - convert current flow to unreachable
10121021
// i.e.
10131022
// try { return "1" } finally { console.log(1); }
@@ -1827,6 +1836,17 @@ namespace ts {
18271836
switch (node.kind) {
18281837
/* Strict mode checks */
18291838
case SyntaxKind.Identifier:
1839+
// for typedef type names with namespaces, bind the new jsdoc type symbol here
1840+
// because it requires all containing namespaces to be in effect, namely the
1841+
// current "blockScopeContainer" needs to be set to its immediate namespace parent.
1842+
if ((<Identifier>node).isInJSDocNamespace) {
1843+
let parentNode = node.parent;
1844+
while (parentNode && parentNode.kind !== SyntaxKind.JSDocTypedefTag) {
1845+
parentNode = parentNode.parent;
1846+
}
1847+
bindBlockScopedDeclaration(<Declaration>parentNode, SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes);
1848+
break;
1849+
}
18301850
case SyntaxKind.ThisKeyword:
18311851
if (currentFlow && (isExpression(node) || parent.kind === SyntaxKind.ShorthandPropertyAssignment)) {
18321852
node.flowNode = currentFlow;
@@ -1950,6 +1970,10 @@ namespace ts {
19501970
case SyntaxKind.InterfaceDeclaration:
19511971
return bindBlockScopedDeclaration(<Declaration>node, SymbolFlags.Interface, SymbolFlags.InterfaceExcludes);
19521972
case SyntaxKind.JSDocTypedefTag:
1973+
if (!(<JSDocTypedefTag>node).fullName || (<JSDocTypedefTag>node).fullName.kind === SyntaxKind.Identifier) {
1974+
return bindBlockScopedDeclaration(<Declaration>node, SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes);
1975+
}
1976+
break;
19531977
case SyntaxKind.TypeAliasDeclaration:
19541978
return bindBlockScopedDeclaration(<Declaration>node, SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes);
19551979
case SyntaxKind.EnumDeclaration:
@@ -2421,6 +2445,9 @@ namespace ts {
24212445
case SyntaxKind.HeritageClause:
24222446
return computeHeritageClause(<HeritageClause>node, subtreeFlags);
24232447

2448+
case SyntaxKind.CatchClause:
2449+
return computeCatchClause(<CatchClause>node, subtreeFlags);
2450+
24242451
case SyntaxKind.ExpressionWithTypeArguments:
24252452
return computeExpressionWithTypeArguments(<ExpressionWithTypeArguments>node, subtreeFlags);
24262453

@@ -2650,6 +2677,17 @@ namespace ts {
26502677
return transformFlags & ~TransformFlags.NodeExcludes;
26512678
}
26522679

2680+
function computeCatchClause(node: CatchClause, subtreeFlags: TransformFlags) {
2681+
let transformFlags = subtreeFlags;
2682+
2683+
if (node.variableDeclaration && isBindingPattern(node.variableDeclaration.name)) {
2684+
transformFlags |= TransformFlags.AssertES2015;
2685+
}
2686+
2687+
node.transformFlags = transformFlags | TransformFlags.HasComputedFlags;
2688+
return transformFlags & ~TransformFlags.NodeExcludes;
2689+
}
2690+
26532691
function computeExpressionWithTypeArguments(node: ExpressionWithTypeArguments, subtreeFlags: TransformFlags) {
26542692
// An ExpressionWithTypeArguments is ES6 syntax, as it is used in the
26552693
// extends clause of a class.

0 commit comments

Comments
 (0)