Skip to content

Add external mapShim/debug modules #33712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 12 additions & 2 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,18 @@ const localize = async () => {
}
};

const buildShims = () => buildProject("src/shims");
const cleanShims = () => cleanProject("src/shims");
cleanTasks.push(cleanShims);

const buildDebugTools = () => buildProject("src/debug");
const cleanDebugTools = () => cleanProject("src/debug");
cleanTasks.push(cleanDebugTools);

const buildShimsAndTools = parallel(buildShims, buildDebugTools);

// Pre-build steps when targeting the LKG compiler
const lkgPreBuild = parallel(generateLibs, series(buildScripts, generateDiagnostics));
const lkgPreBuild = parallel(generateLibs, series(buildScripts, generateDiagnostics, buildShimsAndTools));

const buildTsc = () => buildProject("src/tsc");
task("tsc", series(lkgPreBuild, buildTsc));
Expand All @@ -107,7 +117,7 @@ task("watch-tsc", series(lkgPreBuild, parallel(watchLib, watchDiagnostics, watch
task("watch-tsc").description = "Watch for changes and rebuild the command-line compiler only.";

// Pre-build steps when targeting the built/local compiler.
const localPreBuild = parallel(generateLibs, series(buildScripts, generateDiagnostics, buildTsc));
const localPreBuild = parallel(generateLibs, series(buildScripts, generateDiagnostics, buildShimsAndTools, buildTsc));

// Pre-build steps to use based on supplied options.
const preBuild = cmdLineOptions.lkg ? lkgPreBuild : localPreBuild;
Expand Down
25 changes: 17 additions & 8 deletions src/compiler/binder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,12 @@ namespace ts {
IsObjectLiteralOrClassExpressionMethod = 1 << 7,
}

let flowNodeCreated: <T extends FlowNode>(node: T) => T = identity;
function initFlowNode<T extends FlowNode>(node: T) {
Debug.attachFlowNodeDebugInfo(node);
return node;
}

let flowNodeCreated: <T extends FlowNode>(node: T) => T = initFlowNode;

const binder = createBinder();

Expand Down Expand Up @@ -238,6 +243,10 @@ namespace ts {

Symbol = objectAllocator.getSymbolConstructor();

// Attach debugging information if necessary
Debug.attachFlowNodeDebugInfo(unreachableFlow);
Debug.attachFlowNodeDebugInfo(reportedUnreachableFlow);

if (!file.locals) {
bind(file);
file.symbolCount = symbolCount;
Expand Down Expand Up @@ -626,7 +635,7 @@ namespace ts {
// A non-async, non-generator IIFE is considered part of the containing control flow. Return statements behave
// similarly to break statements that exit to a label just past the statement body.
if (!isIIFE) {
currentFlow = { flags: FlowFlags.Start };
currentFlow = initFlowNode({ flags: FlowFlags.Start });
if (containerFlags & (ContainerFlags.IsFunctionExpression | ContainerFlags.IsObjectLiteralOrClassExpressionMethod)) {
currentFlow.node = <FunctionExpression | ArrowFunction | MethodDeclaration>node;
}
Expand All @@ -638,7 +647,7 @@ namespace ts {
currentContinueTarget = undefined;
activeLabels = undefined;
hasExplicitReturn = false;
flowNodeCreated = identity;
flowNodeCreated = initFlowNode;
bindChildren(node);
// Reset all reachability check related flags on node (for incremental scenarios)
node.flags &= ~NodeFlags.ReachabilityAndEmitFlags;
Expand Down Expand Up @@ -920,11 +929,11 @@ namespace ts {
}

function createBranchLabel(): FlowLabel {
return { flags: FlowFlags.BranchLabel, antecedents: undefined };
return initFlowNode({ flags: FlowFlags.BranchLabel, antecedents: undefined });
}

function createLoopLabel(): FlowLabel {
return { flags: FlowFlags.LoopLabel, antecedents: undefined };
return initFlowNode({ flags: FlowFlags.LoopLabel, antecedents: undefined });
}

function setFlowNodeReferenced(flow: FlowNode) {
Expand Down Expand Up @@ -1194,7 +1203,7 @@ namespace ts {
// as possible antecedents of the start of the `catch` or `finally` blocks.
// Don't bother intercepting the call if there's no finally or catch block that needs the information
if (node.catchClause || node.finallyBlock) {
flowNodeCreated = node => (tryPriors.push(node), node);
flowNodeCreated = node => (tryPriors.push(node), initFlowNode(node));
}
bind(node.tryBlock);
flowNodeCreated = oldFlowNodeCreated;
Expand Down Expand Up @@ -1263,7 +1272,7 @@ namespace ts {
//
// extra edges that we inject allows to control this behavior
// if when walking the flow we step on post-finally edge - we can mark matching pre-finally edge as locked so it will be skipped.
const preFinallyFlow: PreFinallyFlow = { flags: FlowFlags.PreFinally, antecedent: preFinallyPrior, lock: {} };
const preFinallyFlow: PreFinallyFlow = initFlowNode({ flags: FlowFlags.PreFinally, antecedent: preFinallyPrior, lock: {} });
addAntecedent(preFinallyLabel, preFinallyFlow);

currentFlow = finishFlowLabel(preFinallyLabel);
Expand Down Expand Up @@ -1984,7 +1993,7 @@ namespace ts {
const host = getJSDocHost(typeAlias);
container = findAncestor(host.parent, n => !!(getContainerFlags(n) & ContainerFlags.IsContainer)) || file;
blockScopeContainer = getEnclosingBlockScopeContainer(host) || file;
currentFlow = { flags: FlowFlags.Start };
currentFlow = initFlowNode({ flags: FlowFlags.Start });
parent = typeAlias;
bind(typeAlias.typeExpression);
const declName = getNameOfDeclaration(typeAlias);
Expand Down
Loading