MCPcopy Index your code
hub / github.com/nodejs/node / onEnter

Function onEnter

test/fixtures/snapshot/typescript.js:45928–45969  ·  view source on GitHub ↗
(node, state)

Source from the content-addressed store, hash-verified

45926 function createBindBinaryExpressionFlow() {
45927 return ts.createBinaryExpressionTrampoline(onEnter, onLeft, onOperator, onRight, onExit, /*foldState*/ undefined);
45928 function onEnter(node, state) {
45929 if (state) {
45930 state.stackIndex++;
45931 // Emulate the work that `bind` does before reaching `bindChildren`. A normal call to
45932 // `bindBinaryExpressionFlow` will already have done this work.
45933 ts.setParent(node, parent);
45934 var saveInStrictMode = inStrictMode;
45935 bindWorker(node);
45936 var saveParent = parent;
45937 parent = node;
45938 state.skip = false;
45939 state.inStrictModeStack[state.stackIndex] = saveInStrictMode;
45940 state.parentStack[state.stackIndex] = saveParent;
45941 }
45942 else {
45943 state = {
45944 stackIndex: 0,
45945 skip: false,
45946 inStrictModeStack: [undefined],
45947 parentStack: [undefined]
45948 };
45949 }
45950 // TODO: bindLogicalExpression is recursive - if we want to handle deeply nested `&&` expressions
45951 // we'll need to handle the `bindLogicalExpression` scenarios in this state machine, too
45952 // For now, though, since the common cases are chained `+`, leaving it recursive is fine
45953 var operator = node.operatorToken.kind;
45954 if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */ ||
45955 operator === 56 /* SyntaxKind.BarBarToken */ ||
45956 operator === 60 /* SyntaxKind.QuestionQuestionToken */ ||
45957 ts.isLogicalOrCoalescingAssignmentOperator(operator)) {
45958 if (isTopLevelLogicalExpression(node)) {
45959 var postExpressionLabel = createBranchLabel();
45960 bindLogicalLikeExpression(node, postExpressionLabel, postExpressionLabel);
45961 currentFlow = finishFlowLabel(postExpressionLabel);
45962 }
45963 else {
45964 bindLogicalLikeExpression(node, currentTrueTarget, currentFalseTarget);
45965 }
45966 state.skip = true;
45967 }
45968 return state;
45969 }
45970 function onLeft(left, state, node) {
45971 if (!state.skip) {
45972 var maybeBound = maybeBind(left);

Callers

nothing calls this directly

Calls 15

bindWorkerFunction · 0.85
createBranchLabelFunction · 0.85
finishFlowLabelFunction · 0.85
setLeftTypeFunction · 0.85
setLastResultFunction · 0.85
shouldEmitCommentsFunction · 0.85
shouldEmitSourceMapsFunction · 0.85
onBeforeEmitNodeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…