_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q62300 | scanTemplateAndSetTokenValue | test | function scanTemplateAndSetTokenValue() {
var startedWithBacktick = text.charCodeAt(pos) === 96 /* backtick */;
pos++;
var start = pos;
var contents = "";
var resultingToken;
while (true) {
if (pos >= end) {
cont... | javascript | {
"resource": ""
} |
q62301 | utf16EncodeAsString | test | function utf16EncodeAsString(codePoint) {
ts.Debug.assert(0x0 <= codePoint && codePoint <= 0x10FFFF);
if (codePoint <= 65535) {
return String.fromCharCode(codePoint);
}
var codeUnit1 = Math.floor((codePoint - 65536) / 1024) + 0xD800;
var codeUn... | javascript | {
"resource": ""
} |
q62302 | peekUnicodeEscape | test | function peekUnicodeEscape() {
if (pos + 5 < end && text.charCodeAt(pos + 1) === 117 /* u */) {
var start_1 = pos;
pos += 2;
var value = scanExactNumberOfHexDigits(4);
pos = start_1;
return value;
}
retur... | javascript | {
"resource": ""
} |
q62303 | scanJsxIdentifier | test | function scanJsxIdentifier() {
if (tokenIsIdentifierOrKeyword(token)) {
var firstCharPosition = pos;
while (pos < end) {
var ch = text.charCodeAt(pos);
if (ch === 45 /* minus */ || ((firstCharPosition === pos) ? isIdentifierStart(ch, la... | javascript | {
"resource": ""
} |
q62304 | getDeclarationName | test | function getDeclarationName(node) {
if (node.name) {
if (node.kind === 218 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) {
return "\"" + node.name.text + "\"";
}
if (node.name.kind === 136 /* ComputedPropertyName */) ... | javascript | {
"resource": ""
} |
q62305 | bindChildren | test | function bindChildren(node) {
// Before we recurse into a node's chilren, we first save the existing parent, container
// and block-container. Then after we pop out of processing the children, we restore
// these saved values.
var saveParent = parent;
var sav... | javascript | {
"resource": ""
} |
q62306 | nodePosToString | test | function nodePosToString(node) {
var file = getSourceFileOfNode(node);
var loc = ts.getLineAndCharacterOfPosition(file, node.pos);
return file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + ")";
} | javascript | {
"resource": ""
} |
q62307 | unescapeIdentifier | test | function unescapeIdentifier(identifier) {
return identifier.length >= 3 && identifier.charCodeAt(0) === 95 /* _ */ && identifier.charCodeAt(1) === 95 /* _ */ && identifier.charCodeAt(2) === 95 /* _ */ ? identifier.substr(1) : identifier;
} | javascript | {
"resource": ""
} |
q62308 | getEnclosingBlockScopeContainer | test | function getEnclosingBlockScopeContainer(node) {
var current = node.parent;
while (current) {
if (isFunctionLike(current)) {
return current;
}
switch (current.kind) {
case 248 /* SourceFile */:
case 220 /* CaseBlock */:
... | javascript | {
"resource": ""
} |
q62309 | isDeclarationName | test | function isDeclarationName(name) {
if (name.kind !== 69 /* Identifier */ && name.kind !== 9 /* StringLiteral */ && name.kind !== 8 /* NumericLiteral */) {
return false;
}
var parent = name.parent;
if (parent.kind === 226 /* ImportSpecifier */ || parent.kind === 230 /* ExportS... | javascript | {
"resource": ""
} |
q62310 | isIdentifierName | test | function isIdentifierName(node) {
var parent = node.parent;
switch (parent.kind) {
case 141 /* PropertyDeclaration */:
case 140 /* PropertySignature */:
case 143 /* MethodDeclaration */:
case 142 /* MethodSignature */:
case 145 /* GetAccessor *... | javascript | {
"resource": ""
} |
q62311 | getExpandedCharCodes | test | function getExpandedCharCodes(input) {
var output = [];
var length = input.length;
for (var i = 0; i < length; i++) {
var charCode = input.charCodeAt(i);
// handel utf8
if (charCode < 0x80) {
output.push(charCode);
}
els... | javascript | {
"resource": ""
} |
q62312 | textSpanContainsTextSpan | test | function textSpanContainsTextSpan(span, other) {
return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span);
} | javascript | {
"resource": ""
} |
q62313 | isListTerminator | test | function isListTerminator(kind) {
if (token === 1 /* EndOfFileToken */) {
// Being at the end of the file ends all lists.
return true;
}
switch (kind) {
case 1 /* BlockStatements */:
case 2 /* SwitchClauses */:
... | javascript | {
"resource": ""
} |
q62314 | parseEntityName | test | function parseEntityName(allowReservedWords, diagnosticMessage) {
var entity = parseIdentifier(diagnosticMessage);
while (parseOptional(21 /* DotToken */)) {
var node = createNode(135 /* QualifiedName */, entity.pos);
node.left = entity;
node.right... | javascript | {
"resource": ""
} |
q62315 | findHighestListElementThatStartsAtPosition | test | function findHighestListElementThatStartsAtPosition(position) {
// Clear out any cached state about the last node we found.
currentArray = undefined;
currentArrayIndex = -1 /* Value */;
current = undefined;
// Recurse into the source file t... | javascript | {
"resource": ""
} |
q62316 | getSymbolOfPartOfRightHandSideOfImportEquals | test | function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) {
if (!importDeclaration) {
importDeclaration = ts.getAncestor(entityName, 221 /* ImportEqualsDeclaration */);
ts.Debug.assert(importDeclaration !== undefined);
}
// T... | javascript | {
"resource": ""
} |
q62317 | resolveEntityName | test | function resolveEntityName(name, meaning, ignoreErrors) {
if (ts.nodeIsMissing(name)) {
return undefined;
}
var symbol;
if (name.kind === 69 /* Identifier */) {
var message = meaning === 1536 /* Namespace */ ? ts.Diagnostics.Cannot_find_nam... | javascript | {
"resource": ""
} |
q62318 | isReservedMemberName | test | function isReservedMemberName(name) {
return name.charCodeAt(0) === 95 /* _ */ &&
name.charCodeAt(1) === 95 /* _ */ &&
name.charCodeAt(2) !== 95 /* _ */ &&
name.charCodeAt(2) !== 64 /* at */;
} | javascript | {
"resource": ""
} |
q62319 | isSymbolUsedInExportAssignment | test | function isSymbolUsedInExportAssignment(symbol) {
if (exportAssignmentSymbol === symbol) {
return true;
}
if (exportAssignmentSymbol && !!(exportAssignmentSymbol.flags & 8388608 /* Alias */)) {
// if export assig... | javascript | {
"resource": ""
} |
q62320 | getTypeOfPropertyOfType | test | function getTypeOfPropertyOfType(type, name) {
var prop = getPropertyOfType(type, name);
return prop ? getTypeOfSymbol(prop) : undefined;
} | javascript | {
"resource": ""
} |
q62321 | getTypeForBindingElementParent | test | function getTypeForBindingElementParent(node) {
var symbol = getSymbolOfNode(node);
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node);
} | javascript | {
"resource": ""
} |
q62322 | getTypeForBindingElement | test | function getTypeForBindingElement(declaration) {
var pattern = declaration.parent;
var parentType = getTypeForBindingElementParent(pattern.parent);
// If parent has the unknown (error) type, then so does this binding element
if (parentType === unknownType) {
... | javascript | {
"resource": ""
} |
q62323 | getTypeForVariableLikeDeclaration | test | function getTypeForVariableLikeDeclaration(declaration) {
// A variable declared in a for..in statement is always of type any
if (declaration.parent.parent.kind === 200 /* ForInStatement */) {
return anyType;
}
if (declaration.parent.parent.kind === 201 /*... | javascript | {
"resource": ""
} |
q62324 | getTypeFromBindingElement | test | function getTypeFromBindingElement(element, includePatternInType) {
if (element.initializer) {
return getWidenedType(checkExpressionCached(element.initializer));
}
if (ts.isBindingPattern(element.name)) {
return getTypeFromBindingPattern(element.name, ... | javascript | {
"resource": ""
} |
q62325 | getTypeFromObjectBindingPattern | test | function getTypeFromObjectBindingPattern(pattern, includePatternInType) {
var members = {};
ts.forEach(pattern.elements, function (e) {
var flags = 4 /* Property */ | 67108864 /* Transient */ | (e.initializer ? 536870912 /* Optional */ : 0);
var name = e.propertyN... | javascript | {
"resource": ""
} |
q62326 | getLocalTypeParametersOfClassOrInterfaceOrTypeAlias | test | function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) {
var result;
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var node = _a[_i];
if (node.kind === 215 /* InterfaceDeclaration */ || node.kind === 214 /* ClassDeclaration */ ||... | javascript | {
"resource": ""
} |
q62327 | getBaseConstructorTypeOfClass | test | function getBaseConstructorTypeOfClass(type) {
if (!type.resolvedBaseConstructorType) {
var baseTypeNode = getBaseTypeNodeOfClass(type);
if (!baseTypeNode) {
return type.resolvedBaseConstructorType = undefinedType;
}
if (!pu... | javascript | {
"resource": ""
} |
q62328 | isIndependentTypeReference | test | function isIndependentTypeReference(node) {
if (node.typeArguments) {
for (var _i = 0, _a = node.typeArguments; _i < _a.length; _i++) {
var typeNode = _a[_i];
if (!isIndependentType(typeNode)) {
return false;
... | javascript | {
"resource": ""
} |
q62329 | createInstantiatedSymbolTable | test | function createInstantiatedSymbolTable(symbols, mapper, mappingThisOnly) {
var result = {};
for (var _i = 0; _i < symbols.length; _i++) {
var symbol = symbols[_i];
result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(sy... | javascript | {
"resource": ""
} |
q62330 | getUnionSignatures | test | function getUnionSignatures(types, kind) {
var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); });
var result = undefined;
for (var i = 0; i < signatureLists.length; i++) {
for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i+... | javascript | {
"resource": ""
} |
q62331 | getPropertyOfObjectType | test | function getPropertyOfObjectType(type, name) {
if (type.flags & 80896 /* ObjectType */) {
var resolved = resolveStructuredTypeMembers(type);
if (ts.hasProperty(resolved.members, name)) {
var symbol = resolved.members[name];
if (symbolIs... | javascript | {
"resource": ""
} |
q62332 | getApparentType | test | function getApparentType(type) {
if (type.flags & 512 /* TypeParameter */) {
do {
type = getConstraintOfTypeParameter(type);
} while (type && type.flags & 512 /* TypeParameter */);
if (!type) {
type = emptyObjectType;
... | javascript | {
"resource": ""
} |
q62333 | getPropertyOfType | test | function getPropertyOfType(type, name) {
type = getApparentType(type);
if (type.flags & 80896 /* ObjectType */) {
var resolved = resolveStructuredTypeMembers(type);
if (ts.hasProperty(resolved.members, name)) {
var symbol = resolved.members[nam... | javascript | {
"resource": ""
} |
q62334 | getPropagatingFlagsOfTypes | test | function getPropagatingFlagsOfTypes(types) {
var result = 0;
for (var _i = 0; _i < types.length; _i++) {
var type = types[_i];
result |= type.flags;
}
return result & 14680064 /* PropagatingFlags */;
} | javascript | {
"resource": ""
} |
q62335 | getTypeFromClassOrInterfaceReference | test | function getTypeFromClassOrInterfaceReference(node, symbol) {
var type = getDeclaredTypeOfSymbol(symbol);
var typeParameters = type.localTypeParameters;
if (typeParameters) {
if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) {
... | javascript | {
"resource": ""
} |
q62336 | getTypeFromTypeAliasReference | test | function getTypeFromTypeAliasReference(node, symbol) {
var type = getDeclaredTypeOfSymbol(symbol);
var links = getSymbolLinks(symbol);
var typeParameters = links.typeParameters;
if (typeParameters) {
if (!node.typeArguments || node.typeArguments.length !==... | javascript | {
"resource": ""
} |
q62337 | addTypesToSet | test | function addTypesToSet(typeSet, types, typeSetKind) {
for (var _i = 0; _i < types.length; _i++) {
var type = types[_i];
addTypeToSet(typeSet, type, typeSetKind);
}
} | javascript | {
"resource": ""
} |
q62338 | isKnownProperty | test | function isKnownProperty(type, name) {
if (type.flags & 80896 /* ObjectType */) {
var resolved = resolveStructuredTypeMembers(type);
if (relation === assignableRelation && (type === globalObjectType || resolved.properties.length === 0) ||
r... | javascript | {
"resource": ""
} |
q62339 | objectTypeRelatedTo | test | function objectTypeRelatedTo(source, target, reportErrors) {
if (overflow) {
return 0 /* False */;
}
var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id;
var relate... | javascript | {
"resource": ""
} |
q62340 | isDeeplyNestedGeneric | test | function isDeeplyNestedGeneric(type, stack, depth) {
// We track type references (created by createTypeReference) and instantiated types (created by instantiateType)
if (type.flags & (4096 /* Reference */ | 131072 /* Instantiated */) && depth >= 5) {
var symbol = type.symbol;
... | javascript | {
"resource": ""
} |
q62341 | isVariableAssignedWithin | test | function isVariableAssignedWithin(symbol, node) {
var links = getNodeLinks(node);
if (links.assignmentChecks) {
var cachedResult = links.assignmentChecks[symbol.id];
if (cachedResult !== undefined) {
return cachedResult;
}
... | javascript | {
"resource": ""
} |
q62342 | narrowType | test | function narrowType(type, expr, assumeTrue) {
switch (expr.kind) {
case 168 /* CallExpression */:
return narrowTypeByTypePredicate(type, expr, assumeTrue);
case 172 /* ParenthesizedExpression */:
return narrowType(ty... | javascript | {
"resource": ""
} |
q62343 | getContextuallyTypedParameterType | test | function getContextuallyTypedParameterType(parameter) {
var func = parameter.parent;
if (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) {
if (isContextSensitive(func)) {
var contextualSignature = getContextualSignature(func);
... | javascript | {
"resource": ""
} |
q62344 | getContextualTypeForInitializerExpression | test | function getContextualTypeForInitializerExpression(node) {
var declaration = node.parent;
if (node === declaration.initializer) {
if (declaration.type) {
return getTypeFromTypeNode(declaration.type);
}
if (declaration.kind === 1... | javascript | {
"resource": ""
} |
q62345 | applyToContextualType | test | function applyToContextualType(type, mapper) {
if (!(type.flags & 16384 /* Union */)) {
return mapper(type);
}
var types = type.types;
var mappedType;
var mappedTypes;
for (var _i = 0; _i < types.length; _i++) {
var ... | javascript | {
"resource": ""
} |
q62346 | contextualTypeHasIndexSignature | test | function contextualTypeHasIndexSignature(type, kind) {
return !!(type.flags & 16384 /* Union */ ? ts.forEach(type.types, function (t) { return getIndexTypeOfStructuredType(t, kind); }) : getIndexTypeOfStructuredType(type, kind));
} | javascript | {
"resource": ""
} |
q62347 | getContextualTypeForObjectLiteralMethod | test | function getContextualTypeForObjectLiteralMethod(node) {
ts.Debug.assert(ts.isObjectLiteralMethod(node));
if (isInsideWithStatementBody(node)) {
// We cannot answer semantic questions within a with block, do not proceed any further
return undefined;
}
... | javascript | {
"resource": ""
} |
q62348 | getContextualTypeForElementExpression | test | function getContextualTypeForElementExpression(node) {
var arrayLiteral = node.parent;
var type = getContextualType(arrayLiteral);
if (type) {
var index = ts.indexOf(arrayLiteral.elements, node);
return getTypeOfPropertyOfContextualType(type, "" + inde... | javascript | {
"resource": ""
} |
q62349 | getNonGenericSignature | test | function getNonGenericSignature(type) {
var signatures = getSignaturesOfStructuredType(type, 0 /* Call */);
if (signatures.length === 1) {
var signature = signatures[0];
if (!signature.typeParameters) {
return signature;
}
... | javascript | {
"resource": ""
} |
q62350 | getContextualSignature | test | function getContextualSignature(node) {
ts.Debug.assert(node.kind !== 143 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
var type = ts.isObjectLiteralMethod(node)
? getContextualTypeForObjectLiteralMethod(node)
: getContextualType(node);
i... | javascript | {
"resource": ""
} |
q62351 | getJsxAttributePropertySymbol | test | function getJsxAttributePropertySymbol(attrib) {
var attributesType = getJsxElementAttributesType(attrib.parent);
var prop = getPropertyOfType(attributesType, attrib.name.text);
return prop || unknownSymbol;
} | javascript | {
"resource": ""
} |
q62352 | checkClassPropertyAccess | test | function checkClassPropertyAccess(node, left, type, prop) {
var flags = getDeclarationFlagsFromSymbol(prop);
var declaringClass = getDeclaredTypeOfSymbol(prop.parent);
if (left.kind === 95 /* SuperKeyword */) {
var errorNode = node.kind === 166 /* PropertyAccessExpres... | javascript | {
"resource": ""
} |
q62353 | getPropertyNameForIndexedAccess | test | function getPropertyNameForIndexedAccess(indexArgumentExpression, indexArgumentType) {
if (indexArgumentExpression.kind === 9 /* StringLiteral */ || indexArgumentExpression.kind === 8 /* NumericLiteral */) {
return indexArgumentExpression.text;
}
if (indexArgumentExpr... | javascript | {
"resource": ""
} |
q62354 | getSingleCallSignature | test | function getSingleCallSignature(type) {
if (type.flags & 80896 /* ObjectType */) {
var resolved = resolveStructuredTypeMembers(type);
if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 &&
resolved.properties.length === 0 ... | javascript | {
"resource": ""
} |
q62355 | getEffectiveCallArguments | test | function getEffectiveCallArguments(node) {
var args;
if (node.kind === 170 /* TaggedTemplateExpression */) {
var template = node.template;
args = [undefined];
if (template.kind === 183 /* TemplateExpression */) {
ts.forEach(temp... | javascript | {
"resource": ""
} |
q62356 | getEffectiveDecoratorArgumentType | test | function getEffectiveDecoratorArgumentType(node, argIndex) {
if (argIndex === 0) {
return getEffectiveDecoratorFirstArgumentType(node.parent);
}
else if (argIndex === 1) {
return getEffectiveDecoratorSecondArgumentType(node.parent);
}
... | javascript | {
"resource": ""
} |
q62357 | getEffectiveArgumentType | test | function getEffectiveArgumentType(node, argIndex, arg) {
// Decorators provide special arguments, a tagged template expression provides
// a special first argument, and string literals get string literal types
// unless we're reporting errors
if (node.kind === 139 /* Deco... | javascript | {
"resource": ""
} |
q62358 | getEffectiveArgument | test | function getEffectiveArgument(node, args, argIndex) {
// For a decorator or the first argument of a tagged template expression we return undefined.
if (node.kind === 139 /* Decorator */ ||
(argIndex === 0 && node.kind === 170 /* TaggedTemplateExpression */)) {
ret... | javascript | {
"resource": ""
} |
q62359 | getEffectiveArgumentErrorNode | test | function getEffectiveArgumentErrorNode(node, argIndex, arg) {
if (node.kind === 139 /* Decorator */) {
// For a decorator, we use the expression of the decorator for error reporting.
return node.expression;
}
else if (argIndex === 0 && node.kind === 17... | javascript | {
"resource": ""
} |
q62360 | getDiagnosticHeadMessageForDecoratorResolution | test | function getDiagnosticHeadMessageForDecoratorResolution(node) {
switch (node.parent.kind) {
case 214 /* ClassDeclaration */:
case 186 /* ClassExpression */:
return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression;
... | javascript | {
"resource": ""
} |
q62361 | resolveDecorator | test | function resolveDecorator(node, candidatesOutArray) {
var funcType = checkExpression(node.expression);
var apparentType = getApparentType(funcType);
if (apparentType === unknownType) {
return resolveErrorCall(node);
}
var callSignatures = getSi... | javascript | {
"resource": ""
} |
q62362 | getResolvedSignature | test | function getResolvedSignature(node, candidatesOutArray) {
var links = getNodeLinks(node);
// If getResolvedSignature has already been called, we will have cached the resolvedSignature.
// However, it is possible that either candidatesOutArray was not passed in the first time,
... | javascript | {
"resource": ""
} |
q62363 | checkCallExpression | test | function checkCallExpression(node) {
// Grammar checking; stop grammar-checking if checkGrammarTypeArguments return true
checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments);
var signature = getResolvedSignature(node);
if (nod... | javascript | {
"resource": ""
} |
q62364 | assignBindingElementTypes | test | function assignBindingElementTypes(node) {
if (ts.isBindingPattern(node.name)) {
for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) {
var element = _a[_i];
if (element.kind !== 187 /* OmittedExpression */) {
if (ele... | javascript | {
"resource": ""
} |
q62365 | checkTypeParameter | test | function checkTypeParameter(node) {
// Grammar Checking
if (node.expression) {
grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected);
}
checkSourceElement(node.constraint);
if (produceDiagnostics) {
checkTypePa... | javascript | {
"resource": ""
} |
q62366 | getPromisedType | test | function getPromisedType(promise) {
//
// { // promise
// then( // thenFunction
// onfulfilled: ( // onfulfilledParameterType
// value: T // valueParameterType
// ) => any
// ): any;
... | javascript | {
"resource": ""
} |
q62367 | checkDecorator | test | function checkDecorator(node) {
var signature = getResolvedSignature(node);
var returnType = getReturnTypeOfSignature(signature);
if (returnType.flags & 1 /* Any */) {
return;
}
var expectedReturnType;
var headMessage = getDiagnosti... | javascript | {
"resource": ""
} |
q62368 | checkTypeNodeAsExpression | test | function checkTypeNodeAsExpression(node) {
// When we are emitting type metadata for decorators, we need to try to check the type
// as if it were an expression so that we can emit the type in a value position when we
// serialize the type metadata.
if (node && node.kind ... | javascript | {
"resource": ""
} |
q62369 | checkTypeAnnotationAsExpression | test | function checkTypeAnnotationAsExpression(node) {
switch (node.kind) {
case 141 /* PropertyDeclaration */:
checkTypeNodeAsExpression(node.type);
break;
case 138 /* Parameter */:
checkTypeNodeAsExpression(node.type);
... | javascript | {
"resource": ""
} |
q62370 | checkDecorators | test | function checkDecorators(node) {
if (!node.decorators) {
return;
}
// skip this check for nodes that cannot have decorators. These should have already had an error reported by
// checkGrammarDecorators.
if (!ts.nodeCanBeDecorated(node)) {
... | javascript | {
"resource": ""
} |
q62371 | checkIfThisIsCapturedInEnclosingScope | test | function checkIfThisIsCapturedInEnclosingScope(node) {
var current = node;
while (current) {
if (getNodeCheckFlags(current) & 4 /* CaptureThis */) {
var isDeclaration_1 = node.kind !== 69 /* Identifier */;
if (isDeclaration_1) {
... | javascript | {
"resource": ""
} |
q62372 | checkParameterInitializer | test | function checkParameterInitializer(node) {
if (ts.getRootDeclaration(node).kind !== 138 /* Parameter */) {
return;
}
var func = ts.getContainingFunction(node);
visit(node.initializer);
function visit(n) {
if (n.kind === 69 /* Id... | javascript | {
"resource": ""
} |
q62373 | checkVariableLikeDeclaration | test | function checkVariableLikeDeclaration(node) {
checkDecorators(node);
checkSourceElement(node.type);
// For a computed property, just check the initializer and exit
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want... | javascript | {
"resource": ""
} |
q62374 | checkElementTypeOfIterable | test | function checkElementTypeOfIterable(iterable, errorNode) {
var elementType = getElementTypeOfIterable(iterable, errorNode);
// Now even though we have extracted the iteratedType, we will have to validate that the type
// passed in is actually an Iterable.
if (errorNode &&... | javascript | {
"resource": ""
} |
q62375 | checkTypeParameters | test | function checkTypeParameters(typeParameterDeclarations) {
if (typeParameterDeclarations) {
for (var i = 0, n = typeParameterDeclarations.length; i < n; i++) {
var node = typeParameterDeclarations[i];
checkTypeParameter(node);
if (pr... | javascript | {
"resource": ""
} |
q62376 | checkSourceFileWorker | test | function checkSourceFileWorker(node) {
var links = getNodeLinks(node);
if (!(links.flags & 1 /* TypeChecked */)) {
// Check whether the file has declared it is the default lib,
// and whether the user has specifically chosen to avoid checking it.
i... | javascript | {
"resource": ""
} |
q62377 | copySymbol | test | function copySymbol(symbol, meaning) {
if (symbol.flags & meaning) {
var id = symbol.name;
// We will copy all symbol regardless of its reserved name because
// symbolsToArray will check whether the key is a reserved name and
... | javascript | {
"resource": ""
} |
q62378 | getParentTypeOfClassElement | test | function getParentTypeOfClassElement(node) {
var classSymbol = getSymbolOfNode(node.parent);
return node.flags & 128 /* Static */
? getTypeOfSymbol(classSymbol)
: getDeclaredTypeOfSymbol(classSymbol);
} | javascript | {
"resource": ""
} |
q62379 | getAugmentedPropertiesOfType | test | function getAugmentedPropertiesOfType(type) {
type = getApparentType(type);
var propsByName = createSymbolTable(getPropertiesOfType(type));
if (getSignaturesOfType(type, 0 /* Call */).length || getSignaturesOfType(type, 1 /* Construct */).length) {
ts.forEach(getPrope... | javascript | {
"resource": ""
} |
q62380 | getReferencedExportContainer | test | function getReferencedExportContainer(node) {
var symbol = getReferencedValueSymbol(node);
if (symbol) {
if (symbol.flags & 1048576 /* ExportValue */) {
// If we reference an exported entity within the same module declaration, then whether
... | javascript | {
"resource": ""
} |
q62381 | getReferencedImportDeclaration | test | function getReferencedImportDeclaration(node) {
var symbol = getReferencedValueSymbol(node);
return symbol && symbol.flags & 8388608 /* Alias */ ? getDeclarationOfAliasSymbol(symbol) : undefined;
} | javascript | {
"resource": ""
} |
q62382 | getReferencedNestedRedeclaration | test | function getReferencedNestedRedeclaration(node) {
var symbol = getReferencedValueSymbol(node);
return symbol && isNestedRedeclarationSymbol(symbol) ? symbol.valueDeclaration : undefined;
} | javascript | {
"resource": ""
} |
q62383 | getExportDefaultTempVariableName | test | function getExportDefaultTempVariableName() {
var baseName = "_default";
if (!ts.hasProperty(currentSourceFile.identifiers, baseName)) {
return baseName;
}
var count = 0;
while (true) {
var name_18 = baseName + "_" + (++count);
... | javascript | {
"resource": ""
} |
q62384 | emitFiles | test | function emitFiles(resolver, host, targetSourceFile) {
// emit output for the __extends helper function
var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.pro... | javascript | {
"resource": ""
} |
q62385 | makeTempVariableName | test | function makeTempVariableName(flags) {
if (flags && !(tempFlags & flags)) {
var name_19 = flags === 268435456 /* _i */ ? "_i" : "_n";
if (isUniqueName(name_19)) {
tempFlags |= flags;
return name_19;
... | javascript | {
"resource": ""
} |
q62386 | makeUniqueName | test | function makeUniqueName(baseName) {
// Find the first unique 'name_n', where n is a positive number
if (baseName.charCodeAt(baseName.length - 1) !== 95 /* _ */) {
baseName += "_";
}
var i = 1;
while (true) {
... | javascript | {
"resource": ""
} |
q62387 | encodeLastRecordedSourceMapSpan | test | function encodeLastRecordedSourceMapSpan() {
if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) {
return;
}
var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn;
... | javascript | {
"resource": ""
} |
q62388 | createTempVariable | test | function createTempVariable(flags) {
var result = ts.createSynthesizedNode(69 /* Identifier */);
result.text = makeTempVariableName(flags);
return result;
} | javascript | {
"resource": ""
} |
q62389 | indentIfOnDifferentLines | test | function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) {
var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2);
// Always use a newline for synthesized code if the synthesizer desires it.
... | javascript | {
"resource": ""
} |
q62390 | emitExponentiationOperator | test | function emitExponentiationOperator(node) {
var leftHandSideExpression = node.left;
if (node.operatorToken.kind === 60 /* AsteriskAsteriskEqualsToken */) {
var synthesizedLHS;
var shouldEmitParentheses = false;
if (ts.isElementA... | javascript | {
"resource": ""
} |
q62391 | tryEmitStartOfVariableDeclarationList | test | function tryEmitStartOfVariableDeclarationList(decl, startPos) {
if (shouldHoistVariable(decl, /*checkIfSourceFileLevelDecl*/ true)) {
// variables in variable declaration list were already hoisted
return false;
}
var tokenKind = 10... | javascript | {
"resource": ""
} |
q62392 | emitAssignment | test | function emitAssignment(name, value, shouldEmitCommaBeforeAssignment) {
if (shouldEmitCommaBeforeAssignment) {
write(", ");
}
var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name);
if (exportChanged) {
... | javascript | {
"resource": ""
} |
q62393 | emitTempVariableAssignment | test | function emitTempVariableAssignment(expression, canDefineTempVariablesInPlace, shouldEmitCommaBeforeAssignment) {
var identifier = createTempVariable(0 /* Auto */);
if (!canDefineTempVariablesInPlace) {
recordTempDeclaration(identifier);
}
... | javascript | {
"resource": ""
} |
q62394 | ensureIdentifier | test | function ensureIdentifier(expr, reuseIdentifierExpressions) {
if (expr.kind === 69 /* Identifier */ && reuseIdentifierExpressions) {
return expr;
}
var identifier = emitTempVariableAssignment(expr, canDefineTempVariablesInPlace, emitCou... | javascript | {
"resource": ""
} |
q62395 | findSourceFile | test | function findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) {
if (filesByName.contains(fileName)) {
// We've already looked for this file, use cached result
return getSourceFileFromCache(fileName, /*useAbsolutePath*/ false);
}
var normaliz... | javascript | {
"resource": ""
} |
q62396 | readConfigFile | test | function readConfigFile(fileName, readFile) {
var text = "";
try {
text = readFile(fileName);
}
catch (e) {
return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) };
}
return parseConfigFileTextT... | javascript | {
"resource": ""
} |
q62397 | parseConfigFileTextToJson | test | function parseConfigFileTextToJson(fileName, jsonText) {
try {
return { config: /\S/.test(jsonText) ? JSON.parse(jsonText) : {} };
}
catch (e) {
return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) };
}
... | javascript | {
"resource": ""
} |
q62398 | removeDynamicallyNamedProperties | test | function removeDynamicallyNamedProperties(node) {
return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); });
} | javascript | {
"resource": ""
} |
q62399 | getImmediatelyContainingArgumentInfo | test | function getImmediatelyContainingArgumentInfo(node) {
if (node.parent.kind === 168 /* CallExpression */ || node.parent.kind === 169 /* NewExpression */) {
var callExpression = node.parent;
// There are 3 cases to handle:
// 1. The token intro... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.