code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
function visitNode(cbNode, node) { if (node) { return cbNode(node); } }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
visitNode
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function visitNodeArray(cbNodes, nodes) { if (nodes) { return cbNodes(nodes); } }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
visitNodeArray
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function visitEachNode(cbNode, nodes) { if (nodes) { for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { var node = nodes_1[_i]; var result = cbNode(node); if (result) { return result; } } } }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
visitEachNode
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function createSourceFile(fileName, sourceText, languageVersion, setParentNodes) { if (setParentNodes === void 0) { setParentNodes = false; } var start = new Date().getTime(); var result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes); ts.parseTime += new Date().getTime() - start; return result; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
createSourceFile
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parseJSDocTypeExpressionForTests(content, start, length) { return Parser.JSDocParser.parseJSDocTypeExpressionForTests(content, start, length); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parseJSDocTypeExpressionForTests
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes) { var isJavaScriptFile = ts.hasJavaScriptFileExtension(fileName) || _sourceText.lastIndexOf("// @language=javascript", 0) === 0; initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor); var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes); clearState(); return result; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parseSourceFile
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor) { NodeConstructor = ts.objectAllocator.getNodeConstructor(); SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor(); sourceText = _sourceText; syntaxCursor = _syntaxCursor; parseDiagnostics = []; parsingContext = 0; identifiers = {}; identifierCount = 0; nodeCount = 0; contextFlags = isJavaScriptFile ? 32 /* JavaScriptFile */ : 0 /* None */; parseErrorBeforeNextFinishedNode = false; // Initialize and prime the scanner before parsing the source elements. scanner.setText(sourceText); scanner.setOnError(scanError); scanner.setScriptTarget(languageVersion); scanner.setLanguageVariant(ts.allowsJsxExpressions(fileName) ? 1 /* JSX */ : 0 /* Standard */); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
initializeState
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function clearState() { // Clear out the text the scanner is pointing at, so it doesn't keep anything alive unnecessarily. scanner.setText(""); scanner.setOnError(undefined); // Clear any data. We don't want to accidently hold onto it for too long. parseDiagnostics = undefined; sourceFile = undefined; identifiers = undefined; syntaxCursor = undefined; sourceText = undefined; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
clearState
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parseSourceFileWorker(fileName, languageVersion, setParentNodes) { sourceFile = createSourceFile(fileName, languageVersion); if (contextFlags & 32 /* JavaScriptFile */) { sourceFile.parserContextFlags = 32 /* JavaScriptFile */; } // Prime the scanner. token = nextToken(); processReferenceComments(sourceFile); sourceFile.statements = parseList(0 /* SourceElements */, parseStatement); ts.Debug.assert(token === 1 /* EndOfFileToken */); sourceFile.endOfFileToken = parseTokenNode(); setExternalModuleIndicator(sourceFile); sourceFile.nodeCount = nodeCount; sourceFile.identifierCount = identifierCount; sourceFile.identifiers = identifiers; sourceFile.parseDiagnostics = parseDiagnostics; if (setParentNodes) { fixupParentReferences(sourceFile); } // If this is a javascript file, proactively see if we can get JSDoc comments for // relevant nodes in the file. We'll use these to provide typing informaion if they're // available. if (ts.isSourceFileJavaScript(sourceFile)) { addJSDocComments(); } return sourceFile; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parseSourceFileWorker
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function addJSDocComments() { forEachChild(sourceFile, visit); return; function visit(node) { // Add additional cases as necessary depending on how we see JSDoc comments used // in the wild. switch (node.kind) { case 193 /* VariableStatement */: case 213 /* FunctionDeclaration */: case 138 /* Parameter */: addJSDocComment(node); } forEachChild(node, visit); } }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
addJSDocComments
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function visit(node) { // Add additional cases as necessary depending on how we see JSDoc comments used // in the wild. switch (node.kind) { case 193 /* VariableStatement */: case 213 /* FunctionDeclaration */: case 138 /* Parameter */: addJSDocComment(node); } forEachChild(node, visit); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
visit
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function addJSDocComment(node) { var comments = ts.getLeadingCommentRangesOfNode(node, sourceFile); if (comments) { for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) { var comment = comments_1[_i]; var jsDocComment = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos); if (jsDocComment) { node.jsDocComment = jsDocComment; } } } }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
addJSDocComment
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function fixupParentReferences(sourceFile) { // normally parent references are set during binding. However, for clients that only need // a syntax tree, and no semantic features, then the binding process is an unnecessary // overhead. This functions allows us to set all the parents, without all the expense of // binding. var parent = sourceFile; forEachChild(sourceFile, visitNode); return; function visitNode(n) { // walk down setting parents that differ from the parent we think it should be. This // allows us to quickly bail out of setting parents for subtrees during incremental // parsing if (n.parent !== parent) { n.parent = parent; var saveParent = parent; parent = n; forEachChild(n, visitNode); parent = saveParent; } } }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
fixupParentReferences
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function visitNode(n) { // walk down setting parents that differ from the parent we think it should be. This // allows us to quickly bail out of setting parents for subtrees during incremental // parsing if (n.parent !== parent) { n.parent = parent; var saveParent = parent; parent = n; forEachChild(n, visitNode); parent = saveParent; } }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
visitNode
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function createSourceFile(fileName, languageVersion) { // code from createNode is inlined here so createNode won't have to deal with special case of creating source files // this is quite rare comparing to other nodes and createNode should be as fast as possible var sourceFile = new SourceFileConstructor(248 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; sourceFile.languageVersion = languageVersion; sourceFile.fileName = ts.normalizePath(fileName); sourceFile.flags = ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? 4096 /* DeclarationFile */ : 0; sourceFile.languageVariant = ts.allowsJsxExpressions(sourceFile.fileName) ? 1 /* JSX */ : 0 /* Standard */; return sourceFile; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
createSourceFile
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function setContextFlag(val, flag) { if (val) { contextFlags |= flag; } else { contextFlags &= ~flag; } }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
setContextFlag
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function setDisallowInContext(val) { setContextFlag(val, 1 /* DisallowIn */); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
setDisallowInContext
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function setYieldContext(val) { setContextFlag(val, 2 /* Yield */); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
setYieldContext
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function setDecoratorContext(val) { setContextFlag(val, 4 /* Decorator */); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
setDecoratorContext
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function setAwaitContext(val) { setContextFlag(val, 8 /* Await */); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
setAwaitContext
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function doOutsideOfContext(context, func) { // contextFlagsToClear will contain only the context flags that are // currently set that we need to temporarily clear // We don't just blindly reset to the previous flags to ensure // that we do not mutate cached flags for the incremental // parser (ThisNodeHasError, ThisNodeOrAnySubNodesHasError, and // HasAggregatedChildData). var contextFlagsToClear = context & contextFlags; if (contextFlagsToClear) { // clear the requested context flags setContextFlag(false, contextFlagsToClear); var result = func(); // restore the context flags we just cleared setContextFlag(true, contextFlagsToClear); return result; } // no need to do anything special as we are not in any of the requested contexts return func(); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
doOutsideOfContext
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function doInsideOfContext(context, func) { // contextFlagsToSet will contain only the context flags that // are not currently set that we need to temporarily enable. // We don't just blindly reset to the previous flags to ensure // that we do not mutate cached flags for the incremental // parser (ThisNodeHasError, ThisNodeOrAnySubNodesHasError, and // HasAggregatedChildData). var contextFlagsToSet = context & ~contextFlags; if (contextFlagsToSet) { // set the requested context flags setContextFlag(true, contextFlagsToSet); var result = func(); // reset the context flags we just set setContextFlag(false, contextFlagsToSet); return result; } // no need to do anything special as we are already in all of the requested contexts return func(); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
doInsideOfContext
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function allowInAnd(func) { return doOutsideOfContext(1 /* DisallowIn */, func); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
allowInAnd
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function disallowInAnd(func) { return doInsideOfContext(1 /* DisallowIn */, func); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
disallowInAnd
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function doInYieldContext(func) { return doInsideOfContext(2 /* Yield */, func); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
doInYieldContext
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function doOutsideOfYieldContext(func) { return doOutsideOfContext(2 /* Yield */, func); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
doOutsideOfYieldContext
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function doInDecoratorContext(func) { return doInsideOfContext(4 /* Decorator */, func); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
doInDecoratorContext
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function doInAwaitContext(func) { return doInsideOfContext(8 /* Await */, func); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
doInAwaitContext
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function doOutsideOfAwaitContext(func) { return doOutsideOfContext(8 /* Await */, func); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
doOutsideOfAwaitContext
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function doInYieldAndAwaitContext(func) { return doInsideOfContext(2 /* Yield */ | 8 /* Await */, func); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
doInYieldAndAwaitContext
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function doOutsideOfYieldAndAwaitContext(func) { return doOutsideOfContext(2 /* Yield */ | 8 /* Await */, func); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
doOutsideOfYieldAndAwaitContext
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function inContext(flags) { return (contextFlags & flags) !== 0; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
inContext
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function inYieldContext() { return inContext(2 /* Yield */); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
inYieldContext
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function inDisallowInContext() { return inContext(1 /* DisallowIn */); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
inDisallowInContext
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function inDecoratorContext() { return inContext(4 /* Decorator */); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
inDecoratorContext
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function inAwaitContext() { return inContext(8 /* Await */); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
inAwaitContext
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); var length = scanner.getTextPos() - start; parseErrorAtPosition(start, length, message, arg0); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parseErrorAtCurrentToken
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parseErrorAtPosition(start, length, message, arg0) { // Don't report another error if it would just be at the same position as the last error. var lastError = ts.lastOrUndefined(parseDiagnostics); if (!lastError || start !== lastError.start) { parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, start, length, message, arg0)); } // Mark that we've encountered an error. We'll set an appropriate bit on the next // node we finish so that it can't be reused incrementally. parseErrorBeforeNextFinishedNode = true; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parseErrorAtPosition
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function scanError(message, length) { var pos = scanner.getTextPos(); parseErrorAtPosition(pos, length || 0, message); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
scanError
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getNodePos() { return scanner.getStartPos(); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
getNodePos
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getNodeEnd() { return scanner.getStartPos(); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
getNodeEnd
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function nextToken() { return token = scanner.scan(); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
nextToken
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function getTokenPos(pos) { return ts.skipTrivia(sourceText, pos); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
getTokenPos
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function reScanGreaterToken() { return token = scanner.reScanGreaterToken(); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
reScanGreaterToken
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function reScanSlashToken() { return token = scanner.reScanSlashToken(); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
reScanSlashToken
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function reScanTemplateToken() { return token = scanner.reScanTemplateToken(); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
reScanTemplateToken
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function scanJsxIdentifier() { return token = scanner.scanJsxIdentifier(); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
scanJsxIdentifier
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function scanJsxText() { return token = scanner.scanJsxToken(); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
scanJsxText
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function speculationHelper(callback, isLookAhead) { // Keep track of the state we'll need to rollback to if lookahead fails (or if the // caller asked us to always reset our state). var saveToken = token; var saveParseDiagnosticsLength = parseDiagnostics.length; var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; // Note: it is not actually necessary to save/restore the context flags here. That's // because the saving/restoring of these flags happens naturally through the recursive // descent nature of our parser. However, we still store this here just so we can // assert that that invariant holds. var saveContextFlags = contextFlags; // If we're only looking ahead, then tell the scanner to only lookahead as well. // Otherwise, if we're actually speculatively parsing, then tell the scanner to do the // same. var result = isLookAhead ? scanner.lookAhead(callback) : scanner.tryScan(callback); ts.Debug.assert(saveContextFlags === contextFlags); // If our callback returned something 'falsy' or we're just looking ahead, // then unconditionally restore us to where we were. if (!result || isLookAhead) { token = saveToken; parseDiagnostics.length = saveParseDiagnosticsLength; parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode; } return result; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
speculationHelper
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function lookAhead(callback) { return speculationHelper(callback, /*isLookAhead*/ true); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
lookAhead
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function tryParse(callback) { return speculationHelper(callback, /*isLookAhead*/ false); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
tryParse
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isIdentifier() { if (token === 69 /* Identifier */) { return true; } // If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is // considered a keyword and is not an identifier. if (token === 114 /* YieldKeyword */ && inYieldContext()) { return false; } // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is // considered a keyword and is not an identifier. if (token === 119 /* AwaitKeyword */ && inAwaitContext()) { return false; } return token > 105 /* LastReservedWord */; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
isIdentifier
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parseExpected(kind, diagnosticMessage, shouldAdvance) { if (shouldAdvance === void 0) { shouldAdvance = true; } if (token === kind) { if (shouldAdvance) { nextToken(); } return true; } // Report specific message if provided with one. Otherwise, report generic fallback message. if (diagnosticMessage) { parseErrorAtCurrentToken(diagnosticMessage); } else { parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind)); } return false; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parseExpected
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parseOptional(t) { if (token === t) { nextToken(); return true; } return false; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parseOptional
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parseOptionalToken(t) { if (token === t) { return parseTokenNode(); } return undefined; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parseOptionalToken
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parseExpectedToken(t, reportAtCurrentPosition, diagnosticMessage, arg0) { return parseOptionalToken(t) || createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parseExpectedToken
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parseTokenNode() { var node = createNode(token); nextToken(); return finishNode(node); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parseTokenNode
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function canParseSemicolon() { // If there's a real semicolon, then we can always parse it out. if (token === 23 /* SemicolonToken */) { return true; } // We can parse out an optional semicolon in ASI cases in the following cases. return token === 16 /* CloseBraceToken */ || token === 1 /* EndOfFileToken */ || scanner.hasPrecedingLineBreak(); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
canParseSemicolon
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parseSemicolon() { if (canParseSemicolon()) { if (token === 23 /* SemicolonToken */) { // consume the semicolon if it was explicitly provided. nextToken(); } return true; } else { return parseExpected(23 /* SemicolonToken */); } }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parseSemicolon
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function createNode(kind, pos) { nodeCount++; if (!(pos >= 0)) { pos = scanner.getStartPos(); } return new NodeConstructor(kind, pos, pos); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
createNode
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function finishNode(node, end) { node.end = end === undefined ? scanner.getStartPos() : end; if (contextFlags) { node.parserContextFlags = contextFlags; } // Keep track on the node if we encountered an error while parsing it. If we did, then // we cannot reuse the node incrementally. Once we've marked this node, clear out the // flag so that we don't mark any subsequent nodes. if (parseErrorBeforeNextFinishedNode) { parseErrorBeforeNextFinishedNode = false; node.parserContextFlags |= 16 /* ThisNodeHasError */; } return node; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
finishNode
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, arg0) { if (reportAtCurrentPosition) { parseErrorAtPosition(scanner.getStartPos(), 0, diagnosticMessage, arg0); } else { parseErrorAtCurrentToken(diagnosticMessage, arg0); } var result = createNode(kind, scanner.getStartPos()); result.text = ""; return finishNode(result); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
createMissingNode
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function internIdentifier(text) { text = ts.escapeIdentifier(text); return ts.hasProperty(identifiers, text) ? identifiers[text] : (identifiers[text] = text); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
internIdentifier
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parseIdentifier(diagnosticMessage) { return createIdentifier(isIdentifier(), diagnosticMessage); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parseIdentifier
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parseIdentifierName() { return createIdentifier(ts.tokenIsIdentifierOrKeyword(token)); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parseIdentifierName
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isLiteralPropertyName() { return ts.tokenIsIdentifierOrKeyword(token) || token === 9 /* StringLiteral */ || token === 8 /* NumericLiteral */; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
isLiteralPropertyName
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parsePropertyNameWorker(allowComputedPropertyNames) { if (token === 9 /* StringLiteral */ || token === 8 /* NumericLiteral */) { return parseLiteralNode(/*internName*/ true); } if (allowComputedPropertyNames && token === 19 /* OpenBracketToken */) { return parseComputedPropertyName(); } return parseIdentifierName(); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parsePropertyNameWorker
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parsePropertyName() { return parsePropertyNameWorker(/*allowComputedPropertyNames:*/ true); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parsePropertyName
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parseSimplePropertyName() { return parsePropertyNameWorker(/*allowComputedPropertyNames:*/ false); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parseSimplePropertyName
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isSimplePropertyName() { return token === 9 /* StringLiteral */ || token === 8 /* NumericLiteral */ || ts.tokenIsIdentifierOrKeyword(token); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
isSimplePropertyName
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parseComputedPropertyName() { // PropertyName [Yield]: // LiteralPropertyName // ComputedPropertyName[?Yield] var node = createNode(136 /* ComputedPropertyName */); parseExpected(19 /* OpenBracketToken */); // We parse any expression (including a comma expression). But the grammar // says that only an assignment expression is allowed, so the grammar checker // will error if it sees a comma expression. node.expression = allowInAnd(parseExpression); parseExpected(20 /* CloseBracketToken */); return finishNode(node); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parseComputedPropertyName
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parseContextualModifier(t) { return token === t && tryParse(nextTokenCanFollowModifier); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parseContextualModifier
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function nextTokenCanFollowModifier() { if (token === 74 /* ConstKeyword */) { // 'const' is only a modifier if followed by 'enum'. return nextToken() === 81 /* EnumKeyword */; } if (token === 82 /* ExportKeyword */) { nextToken(); if (token === 77 /* DefaultKeyword */) { return lookAhead(nextTokenIsClassOrFunction); } return token !== 37 /* AsteriskToken */ && token !== 15 /* OpenBraceToken */ && canFollowModifier(); } if (token === 77 /* DefaultKeyword */) { return nextTokenIsClassOrFunction(); } if (token === 113 /* StaticKeyword */) { nextToken(); return canFollowModifier(); } nextToken(); if (scanner.hasPrecedingLineBreak()) { return false; } return canFollowModifier(); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
nextTokenCanFollowModifier
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parseAnyContextualModifier() { return ts.isModifier(token) && tryParse(nextTokenCanFollowModifier); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parseAnyContextualModifier
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function canFollowModifier() { return token === 19 /* OpenBracketToken */ || token === 15 /* OpenBraceToken */ || token === 37 /* AsteriskToken */ || isLiteralPropertyName(); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
canFollowModifier
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function nextTokenIsClassOrFunction() { nextToken(); return token === 73 /* ClassKeyword */ || token === 87 /* FunctionKeyword */; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
nextTokenIsClassOrFunction
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isListElement(parsingContext, inErrorRecovery) { var node = currentNode(parsingContext); if (node) { return true; } switch (parsingContext) { case 0 /* SourceElements */: case 1 /* BlockStatements */: case 3 /* SwitchClauseStatements */: // If we're in error recovery, then we don't want to treat ';' as an empty statement. // The problem is that ';' can show up in far too many contexts, and if we see one // and assume it's a statement, then we may bail out inappropriately from whatever // we're parsing. For example, if we have a semicolon in the middle of a class, then // we really don't want to assume the class is over and we're on a statement in the // outer module. We just want to consume and move on. return !(token === 23 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement(); case 2 /* SwitchClauses */: return token === 71 /* CaseKeyword */ || token === 77 /* DefaultKeyword */; case 4 /* TypeMembers */: return isStartOfTypeMember(); case 5 /* ClassMembers */: // We allow semicolons as class elements (as specified by ES6) as long as we're // not in error recovery. If we're in error recovery, we don't want an errant // semicolon to be treated as a class member (since they're almost always used // for statements. return lookAhead(isClassMemberStart) || (token === 23 /* SemicolonToken */ && !inErrorRecovery); case 6 /* EnumMembers */: // Include open bracket computed properties. This technically also lets in indexers, // which would be a candidate for improved error reporting. return token === 19 /* OpenBracketToken */ || isLiteralPropertyName(); case 12 /* ObjectLiteralMembers */: return token === 19 /* OpenBracketToken */ || token === 37 /* AsteriskToken */ || isLiteralPropertyName(); case 9 /* ObjectBindingElements */: return token === 19 /* OpenBracketToken */ || isLiteralPropertyName(); case 7 /* HeritageClauseElement */: // If we see { } then only consume it as an expression if it is followed by , or { // That way we won't consume the body of a class in its heritage clause. if (token === 15 /* OpenBraceToken */) { return lookAhead(isValidHeritageClauseObjectLiteral); } if (!inErrorRecovery) { return isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword(); } else { // If we're in error recovery we tighten up what we're willing to match. // That way we don't treat something like "this" as a valid heritage clause // element during recovery. return isIdentifier() && !isHeritageClauseExtendsOrImplementsKeyword(); } case 8 /* VariableDeclarations */: return isIdentifierOrPattern(); case 10 /* ArrayBindingElements */: return token === 24 /* CommaToken */ || token === 22 /* DotDotDotToken */ || isIdentifierOrPattern(); case 17 /* TypeParameters */: return isIdentifier(); case 11 /* ArgumentExpressions */: case 15 /* ArrayLiteralMembers */: return token === 24 /* CommaToken */ || token === 22 /* DotDotDotToken */ || isStartOfExpression(); case 16 /* Parameters */: return isStartOfParameter(); case 18 /* TypeArguments */: case 19 /* TupleElementTypes */: return token === 24 /* CommaToken */ || isStartOfType(); case 20 /* HeritageClauses */: return isHeritageClause(); case 21 /* ImportOrExportSpecifiers */: return ts.tokenIsIdentifierOrKeyword(token); case 13 /* JsxAttributes */: return ts.tokenIsIdentifierOrKeyword(token) || token === 15 /* OpenBraceToken */; case 14 /* JsxChildren */: return true; case 22 /* JSDocFunctionParameters */: case 23 /* JSDocTypeArguments */: case 25 /* JSDocTupleTypes */: return JSDocParser.isJSDocType(); case 24 /* JSDocRecordMembers */: return isSimplePropertyName(); } ts.Debug.fail("Non-exhaustive case in 'isListElement'."); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
isListElement
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isValidHeritageClauseObjectLiteral() { ts.Debug.assert(token === 15 /* OpenBraceToken */); if (nextToken() === 16 /* CloseBraceToken */) { // if we see "extends {}" then only treat the {} as what we're extending (and not // the class body) if we have: // // extends {} { // extends {}, // extends {} extends // extends {} implements var next = nextToken(); return next === 24 /* CommaToken */ || next === 15 /* OpenBraceToken */ || next === 83 /* ExtendsKeyword */ || next === 106 /* ImplementsKeyword */; } return true; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
isValidHeritageClauseObjectLiteral
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function nextTokenIsIdentifier() { nextToken(); return isIdentifier(); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
nextTokenIsIdentifier
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function nextTokenIsIdentifierOrKeyword() { nextToken(); return ts.tokenIsIdentifierOrKeyword(token); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
nextTokenIsIdentifierOrKeyword
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isHeritageClauseExtendsOrImplementsKeyword() { if (token === 106 /* ImplementsKeyword */ || token === 83 /* ExtendsKeyword */) { return lookAhead(nextTokenIsStartOfExpression); } return false; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
isHeritageClauseExtendsOrImplementsKeyword
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function nextTokenIsStartOfExpression() { nextToken(); return isStartOfExpression(); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
nextTokenIsStartOfExpression
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isVariableDeclaratorListTerminator() { // If we can consume a semicolon (either explicitly, or with ASI), then consider us done // with parsing the list of variable declarators. if (canParseSemicolon()) { return true; } // in the case where we're parsing the variable declarator of a 'for-in' statement, we // are done if we see an 'in' keyword in front of us. Same with for-of if (isInOrOfKeyword(token)) { return true; } // ERROR RECOVERY TWEAK: // For better error recovery, if we see an '=>' then we just stop immediately. We've got an // arrow function here and it's going to be very unlikely that we'll resynchronize and get // another variable declaration. if (token === 34 /* EqualsGreaterThanToken */) { return true; } // Keep trying to parse out variable declarators. return false; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
isVariableDeclaratorListTerminator
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isInSomeParsingContext() { for (var kind = 0; kind < 26 /* Count */; kind++) { if (parsingContext & (1 << kind)) { if (isListElement(kind, /* inErrorRecovery */ true) || isListTerminator(kind)) { return true; } } } return false; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
isInSomeParsingContext
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parseList(kind, parseElement) { var saveParsingContext = parsingContext; parsingContext |= 1 << kind; var result = []; result.pos = getNodePos(); while (!isListTerminator(kind)) { if (isListElement(kind, /* inErrorRecovery */ false)) { var element = parseListElement(kind, parseElement); result.push(element); continue; } if (abortParsingListOrMoveToNextToken(kind)) { break; } } result.end = getNodeEnd(); parsingContext = saveParsingContext; return result; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parseList
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parseListElement(parsingContext, parseElement) { var node = currentNode(parsingContext); if (node) { return consumeNode(node); } return parseElement(); }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parseListElement
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function currentNode(parsingContext) { // If there is an outstanding parse error that we've encountered, but not attached to // some node, then we cannot get a node from the old source tree. This is because we // want to mark the next node we encounter as being unusable. // // Note: This may be too conservative. Perhaps we could reuse the node and set the bit // on it (or its leftmost child) as having the error. For now though, being conservative // is nice and likely won't ever affect perf. if (parseErrorBeforeNextFinishedNode) { return undefined; } if (!syntaxCursor) { // if we don't have a cursor, we could never return a node from the old tree. return undefined; } var node = syntaxCursor.currentNode(scanner.getStartPos()); // Can't reuse a missing node. if (ts.nodeIsMissing(node)) { return undefined; } // Can't reuse a node that intersected the change range. if (node.intersectsChange) { return undefined; } // Can't reuse a node that contains a parse error. This is necessary so that we // produce the same set of errors again. if (ts.containsParseError(node)) { return undefined; } // We can only reuse a node if it was parsed under the same strict mode that we're // currently in. i.e. if we originally parsed a node in non-strict mode, but then // the user added 'using strict' at the top of the file, then we can't use that node // again as the presense of strict mode may cause us to parse the tokens in the file // differetly. // // Note: we *can* reuse tokens when the strict mode changes. That's because tokens // are unaffected by strict mode. It's just the parser will decide what to do with it // differently depending on what mode it is in. // // This also applies to all our other context flags as well. var nodeContextFlags = node.parserContextFlags & 31 /* ParserGeneratedFlags */; if (nodeContextFlags !== contextFlags) { return undefined; } // Ok, we have a node that looks like it could be reused. Now verify that it is valid // in the currest list parsing context that we're currently at. if (!canReuseNode(node, parsingContext)) { return undefined; } return node; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
currentNode
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function consumeNode(node) { // Move the scanner so it is after the node we just consumed. scanner.setTextPos(node.end); nextToken(); return node; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
consumeNode
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function canReuseNode(node, parsingContext) { switch (parsingContext) { case 5 /* ClassMembers */: return isReusableClassMember(node); case 2 /* SwitchClauses */: return isReusableSwitchClause(node); case 0 /* SourceElements */: case 1 /* BlockStatements */: case 3 /* SwitchClauseStatements */: return isReusableStatement(node); case 6 /* EnumMembers */: return isReusableEnumMember(node); case 4 /* TypeMembers */: return isReusableTypeMember(node); case 8 /* VariableDeclarations */: return isReusableVariableDeclaration(node); case 16 /* Parameters */: return isReusableParameter(node); // Any other lists we do not care about reusing nodes in. But feel free to add if // you can do so safely. Danger areas involve nodes that may involve speculative // parsing. If speculative parsing is involved with the node, then the range the // parser reached while looking ahead might be in the edited range (see the example // in canReuseVariableDeclaratorNode for a good case of this). case 20 /* HeritageClauses */: // This would probably be safe to reuse. There is no speculative parsing with // heritage clauses. case 17 /* TypeParameters */: // This would probably be safe to reuse. There is no speculative parsing with // type parameters. Note that that's because type *parameters* only occur in // unambiguous *type* contexts. While type *arguments* occur in very ambiguous // *expression* contexts. case 19 /* TupleElementTypes */: // This would probably be safe to reuse. There is no speculative parsing with // tuple types. // Technically, type argument list types are probably safe to reuse. While // speculative parsing is involved with them (since type argument lists are only // produced from speculative parsing a < as a type argument list), we only have // the types because speculative parsing succeeded. Thus, the lookahead never // went past the end of the list and rewound. case 18 /* TypeArguments */: // Note: these are almost certainly not safe to ever reuse. Expressions commonly // need a large amount of lookahead, and we should not reuse them as they may // have actually intersected the edit. case 11 /* ArgumentExpressions */: // This is not safe to reuse for the same reason as the 'AssignmentExpression' // cases. i.e. a property assignment may end with an expression, and thus might // have lookahead far beyond it's old node. case 12 /* ObjectLiteralMembers */: // This is probably not safe to reuse. There can be speculative parsing with // type names in a heritage clause. There can be generic names in the type // name list, and there can be left hand side expressions (which can have type // arguments.) case 7 /* HeritageClauseElement */: // Perhaps safe to reuse, but it's unlikely we'd see more than a dozen attributes // on any given element. Same for children. case 13 /* JsxAttributes */: case 14 /* JsxChildren */: } return false; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
canReuseNode
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isReusableClassMember(node) { if (node) { switch (node.kind) { case 144 /* Constructor */: case 149 /* IndexSignature */: case 145 /* GetAccessor */: case 146 /* SetAccessor */: case 141 /* PropertyDeclaration */: case 191 /* SemicolonClassElement */: return true; case 143 /* MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal // may have a method calls "constructor(...)" and we must reparse that // into an actual .ConstructorDeclaration. var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 69 /* Identifier */ && methodDeclaration.name.originalKeywordKind === 121 /* ConstructorKeyword */; return !nameIsConstructor; } } return false; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
isReusableClassMember
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isReusableSwitchClause(node) { if (node) { switch (node.kind) { case 241 /* CaseClause */: case 242 /* DefaultClause */: return true; } } return false; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
isReusableSwitchClause
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isReusableStatement(node) { if (node) { switch (node.kind) { case 213 /* FunctionDeclaration */: case 193 /* VariableStatement */: case 192 /* Block */: case 196 /* IfStatement */: case 195 /* ExpressionStatement */: case 208 /* ThrowStatement */: case 204 /* ReturnStatement */: case 206 /* SwitchStatement */: case 203 /* BreakStatement */: case 202 /* ContinueStatement */: case 200 /* ForInStatement */: case 201 /* ForOfStatement */: case 199 /* ForStatement */: case 198 /* WhileStatement */: case 205 /* WithStatement */: case 194 /* EmptyStatement */: case 209 /* TryStatement */: case 207 /* LabeledStatement */: case 197 /* DoStatement */: case 210 /* DebuggerStatement */: case 222 /* ImportDeclaration */: case 221 /* ImportEqualsDeclaration */: case 228 /* ExportDeclaration */: case 227 /* ExportAssignment */: case 218 /* ModuleDeclaration */: case 214 /* ClassDeclaration */: case 215 /* InterfaceDeclaration */: case 217 /* EnumDeclaration */: case 216 /* TypeAliasDeclaration */: return true; } } return false; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
isReusableStatement
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isReusableEnumMember(node) { return node.kind === 247 /* EnumMember */; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
isReusableEnumMember
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isReusableTypeMember(node) { if (node) { switch (node.kind) { case 148 /* ConstructSignature */: case 142 /* MethodSignature */: case 149 /* IndexSignature */: case 140 /* PropertySignature */: case 147 /* CallSignature */: return true; } } return false; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
isReusableTypeMember
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isReusableVariableDeclaration(node) { if (node.kind !== 211 /* VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: // // let v = new List < A, B // // This is actually legal code. It's a list of variable declarators "v = new List<A" // on one side and "B" on the other. If you then change that to: // // let v = new List < A, B >() // // then we have a problem. "v = new List<A" doesn't intersect the change range, so we // start reparsing at "B" and we completely fail to handle this properly. // // In order to prevent this, we do not allow a variable declarator to be reused if it // has an initializer. var variableDeclarator = node; return variableDeclarator.initializer === undefined; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
isReusableVariableDeclaration
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function isReusableParameter(node) { if (node.kind !== 138 /* Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. var parameter = node; return parameter.initializer === undefined; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
isReusableParameter
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function abortParsingListOrMoveToNextToken(kind) { parseErrorAtCurrentToken(parsingContextErrors(kind)); if (isInSomeParsingContext()) { return true; } nextToken(); return false; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
abortParsingListOrMoveToNextToken
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parsingContextErrors(context) { switch (context) { case 0 /* SourceElements */: return ts.Diagnostics.Declaration_or_statement_expected; case 1 /* BlockStatements */: return ts.Diagnostics.Declaration_or_statement_expected; case 2 /* SwitchClauses */: return ts.Diagnostics.case_or_default_expected; case 3 /* SwitchClauseStatements */: return ts.Diagnostics.Statement_expected; case 4 /* TypeMembers */: return ts.Diagnostics.Property_or_signature_expected; case 5 /* ClassMembers */: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; case 6 /* EnumMembers */: return ts.Diagnostics.Enum_member_expected; case 7 /* HeritageClauseElement */: return ts.Diagnostics.Expression_expected; case 8 /* VariableDeclarations */: return ts.Diagnostics.Variable_declaration_expected; case 9 /* ObjectBindingElements */: return ts.Diagnostics.Property_destructuring_pattern_expected; case 10 /* ArrayBindingElements */: return ts.Diagnostics.Array_element_destructuring_pattern_expected; case 11 /* ArgumentExpressions */: return ts.Diagnostics.Argument_expression_expected; case 12 /* ObjectLiteralMembers */: return ts.Diagnostics.Property_assignment_expected; case 15 /* ArrayLiteralMembers */: return ts.Diagnostics.Expression_or_comma_expected; case 16 /* Parameters */: return ts.Diagnostics.Parameter_declaration_expected; case 17 /* TypeParameters */: return ts.Diagnostics.Type_parameter_declaration_expected; case 18 /* TypeArguments */: return ts.Diagnostics.Type_argument_expected; case 19 /* TupleElementTypes */: return ts.Diagnostics.Type_expected; case 20 /* HeritageClauses */: return ts.Diagnostics.Unexpected_token_expected; case 21 /* ImportOrExportSpecifiers */: return ts.Diagnostics.Identifier_expected; case 13 /* JsxAttributes */: return ts.Diagnostics.Identifier_expected; case 14 /* JsxChildren */: return ts.Diagnostics.Identifier_expected; case 22 /* JSDocFunctionParameters */: return ts.Diagnostics.Parameter_declaration_expected; case 23 /* JSDocTypeArguments */: return ts.Diagnostics.Type_argument_expected; case 25 /* JSDocTupleTypes */: return ts.Diagnostics.Type_expected; case 24 /* JSDocRecordMembers */: return ts.Diagnostics.Property_assignment_expected; } }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parsingContextErrors
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimeter) { var saveParsingContext = parsingContext; parsingContext |= 1 << kind; var result = []; result.pos = getNodePos(); var commaStart = -1; // Meaning the previous token was not a comma while (true) { if (isListElement(kind, /* inErrorRecovery */ false)) { result.push(parseListElement(kind, parseElement)); commaStart = scanner.getTokenPos(); if (parseOptional(24 /* CommaToken */)) { continue; } commaStart = -1; // Back to the state where the last token was not a comma if (isListTerminator(kind)) { break; } // We didn't get a comma, and the list wasn't terminated, explicitly parse // out a comma so we give a good error message. parseExpected(24 /* CommaToken */); // If the token was a semicolon, and the caller allows that, then skip it and // continue. This ensures we get back on track and don't result in tons of // parse errors. For example, this can happen when people do things like use // a semicolon to delimit object literal members. Note: we'll have already // reported an error when we called parseExpected above. if (considerSemicolonAsDelimeter && token === 23 /* SemicolonToken */ && !scanner.hasPrecedingLineBreak()) { nextToken(); } continue; } if (isListTerminator(kind)) { break; } if (abortParsingListOrMoveToNextToken(kind)) { break; } } // Recording the trailing comma is deliberately done after the previous // loop, and not just if we see a list terminator. This is because the list // may have ended incorrectly, but it is still important to know if there // was a trailing comma. // Check if the last token was a comma. if (commaStart >= 0) { // Always preserve a trailing comma by marking it on the NodeArray result.hasTrailingComma = true; } result.end = getNodeEnd(); parsingContext = saveParsingContext; return result; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
parseDelimitedList
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function createMissingList() { var pos = getNodePos(); var result = []; result.pos = pos; result.end = pos; return result; }
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn. This function will then merge those changes into a single change range valid between V1 and Vn.
createMissingList
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT