Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c95daab
Add support for Optional Chaining
rbuckton Sep 6, 2019
c2f53fc
Add grammar error for invalid tagged template, more tests
rbuckton Sep 7, 2019
0f5d5d6
Prototype
andrewbranch Sep 23, 2019
24de747
Merge branch 'master' into optionalChainingStage3
rbuckton Sep 23, 2019
7be47ab
PR feedback
rbuckton Sep 24, 2019
e073c05
Add errors for invalid assignments and a trailing '?.'
rbuckton Sep 24, 2019
72f44d9
Add additional signature help test, fix lint warnings
rbuckton Sep 24, 2019
488c9e6
Merge branch 'master' into optionalChainingStage3
rbuckton Sep 24, 2019
2ffd8e1
Merge branch 'enhancement/auto-insert-question-dot' of github.com:and…
rbuckton Sep 24, 2019
096bb49
Fix to insert text for completions
rbuckton Sep 24, 2019
1bf2d56
Add initial control-flow analysis for optional chains
rbuckton Sep 25, 2019
1d7446f
PR Feedback and more tests
rbuckton Sep 26, 2019
b282b62
Update to control flow
rbuckton Sep 26, 2019
be3e21f
Merge branch 'master' into optionalChainingStage3
rbuckton Sep 26, 2019
fd8c0d4
Remove mangled smart quotes in comments
rbuckton Sep 26, 2019
7c9ef50
Fix lint, PR feedback
rbuckton Sep 27, 2019
ad7c33c
Updates to control flow
rbuckton Sep 28, 2019
6b49a03
Switch to FlowCondition for CFA of optional chains
rbuckton Sep 29, 2019
aaa30f4
Fix ?. insertion for completions on type variables
rbuckton Sep 29, 2019
5ea7cb5
Accept API baseline change
rbuckton Sep 29, 2019
7463860
Clean up types
rbuckton Sep 29, 2019
0828674
improve control-flow debug output
rbuckton Sep 30, 2019
d408e81
Merge branch 'master' into optionalChainingStage3
rbuckton Sep 30, 2019
c2070be
Revert Debug.formatControlFlowGraph helper
rbuckton Sep 30, 2019
dfc798f
Merge branch 'master' into optionalChainingStage3
rbuckton Sep 30, 2019
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
Merge branch 'master' into optionalChainingStage3
  • Loading branch information
rbuckton committed Sep 30, 2019
commit d408e81ad247ab5a11e94277f8d89a2f27b3be70
2 changes: 1 addition & 1 deletion src/compiler/binder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ namespace ts {

function bindCondition(node: Expression | undefined, trueTarget: FlowLabel, falseTarget: FlowLabel) {
doWithConditionalBranches(bind, node, trueTarget, falseTarget);
if (!node || !isLogicalExpression(node)) {
if (!node || !isLogicalExpression(node) && !(isOptionalChain(node) && isOutermostOptionalChain(node))) {
addAntecedent(trueTarget, createFlowCondition(FlowFlags.TrueCondition, currentFlow, node));
addAntecedent(falseTarget, createFlowCondition(FlowFlags.FalseCondition, currentFlow, node));
}
Expand Down
16 changes: 3 additions & 13 deletions src/compiler/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ namespace ts {
udl = "┤",
dlr = "┬",
ulr = "┴",
udlr = "",
udlr = "",
}

const enum Connection {
Expand Down Expand Up @@ -415,12 +415,8 @@ namespace ts {
nodes.push(graphNode);
if (!(flowNode.flags & FlowFlags.PreFinally)) {
if (hasAntecedents(flowNode)) {
// sort antecedents so that shallower trees come first.
const antecedents = flowNode.antecedents;
const heights = antecedents.map(measureHeight);
const indices = antecedents.map((_, i) => i);
stableSortIndices(heights, indices, (a, b) => b - a);
for (const antecedent of indices.map(i => antecedents[i])) {

for (const antecedent of flowNode.antecedents) {
buildGraphEdge(graphNode, antecedent);
}
}
Expand Down Expand Up @@ -451,12 +447,6 @@ namespace ts {
return node.level = level;
}

function measureHeight(flowNode: FlowNode): number {
return hasAntecedents(flowNode) ? flowNode.antecedents.reduce((x, n) => Math.max(x, measureHeight(n)), 0) + 1 :
hasAntecedent(flowNode) ? measureHeight(flowNode.antecedent) + 1 :
1;
}

function computeHeight(node: FlowGraphNode): number {
let height = 0;
for (const child of getChildren(node)) {
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.