mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into exportEquals
Conflicts: src/compiler/checker.ts src/compiler/diagnosticInformationMap.generated.ts src/compiler/emitter.ts tests/baselines/reference/es6ImportDefaultBinding.errors.txt tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.errors.txt tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportInEs5.errors.txt tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding.errors.txt tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.errors.txt tests/baselines/reference/es6ImportDefaultBindingInEs5.errors.txt
This commit is contained in:
@@ -0,0 +1 @@
|
||||
*.js linguist-language=TypeScript
|
||||
+1
-10
@@ -3,13 +3,4 @@ language: node_js
|
||||
node_js:
|
||||
- '0.10'
|
||||
|
||||
sudo: false
|
||||
|
||||
before_script: npm install -g codeclimate-test-reporter
|
||||
|
||||
after_script:
|
||||
- cat coverage/lcov.info | codeclimate
|
||||
|
||||
addons:
|
||||
code_climate:
|
||||
repo_token: 9852ac5362c8cc38c07ca5adc0f94c20c6c79bd78e17933dc284598a65338656
|
||||
sudo: false
|
||||
@@ -39,6 +39,7 @@ var compilerSources = [
|
||||
"utilities.ts",
|
||||
"binder.ts",
|
||||
"checker.ts",
|
||||
"declarationEmitter.ts",
|
||||
"emitter.ts",
|
||||
"program.ts",
|
||||
"commandLineParser.ts",
|
||||
@@ -57,6 +58,7 @@ var servicesSources = [
|
||||
"utilities.ts",
|
||||
"binder.ts",
|
||||
"checker.ts",
|
||||
"declarationEmitter.ts",
|
||||
"emitter.ts",
|
||||
"program.ts",
|
||||
"commandLineParser.ts",
|
||||
@@ -65,7 +67,7 @@ var servicesSources = [
|
||||
return path.join(compilerDirectory, f);
|
||||
}).concat([
|
||||
"breakpoints.ts",
|
||||
"navigateTo.ts",
|
||||
"navigateTo.ts",
|
||||
"navigationBar.ts",
|
||||
"outliningElementsCollector.ts",
|
||||
"patternMatcher.ts",
|
||||
@@ -539,7 +541,7 @@ function cleanTestDirs() {
|
||||
}
|
||||
|
||||
jake.mkdirP(localRwcBaseline);
|
||||
jake.mkdirP(localTest262Baseline);
|
||||
jake.mkdirP(localTest262Baseline);
|
||||
jake.mkdirP(localBaseline);
|
||||
}
|
||||
|
||||
@@ -718,7 +720,7 @@ file(loggedIOJsPath, [builtLocalDirectory, loggedIOpath], function() {
|
||||
|
||||
var instrumenterPath = harnessDirectory + 'instrumenter.ts';
|
||||
var instrumenterJsPath = builtLocalDirectory + 'instrumenter.js';
|
||||
compileFile(instrumenterJsPath, [instrumenterPath], [tscFile, instrumenterPath], [], /*useBuiltCompiler*/ true);
|
||||
compileFile(instrumenterJsPath, [instrumenterPath], [tscFile, instrumenterPath].concat(libraryTargets), [], /*useBuiltCompiler*/ true);
|
||||
|
||||
desc("Builds an instrumented tsc.js");
|
||||
task('tsc-instrumented', [loggedIOJsPath, instrumenterJsPath, tscFile], function() {
|
||||
|
||||
+2
-3
@@ -38,10 +38,9 @@
|
||||
"mocha": "latest",
|
||||
"chai": "latest",
|
||||
"browserify": "latest",
|
||||
"istanbul": "latest",
|
||||
"codeclimate-test-reporter": "latest"
|
||||
"istanbul": "latest"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jake generate-code-coverage"
|
||||
"test": "jake runtests"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,8 +65,7 @@ function buildInfoFileOutput(messageTable: InputDiagnosticMessageTable, nameMap:
|
||||
' ' + convertPropertyName(nameMap[name]) +
|
||||
': { code: ' + diagnosticDetails.code +
|
||||
', category: DiagnosticCategory.' + diagnosticDetails.category +
|
||||
', key: "' + name.replace('"', '\\"') + '"' +
|
||||
(diagnosticDetails.isEarly ? ', isEarly: true' : '') +
|
||||
', key: "' + name.replace(/[\"]/g, '\\"') + '"' +
|
||||
' },\r\n';
|
||||
}
|
||||
|
||||
|
||||
@@ -346,13 +346,14 @@ module ts {
|
||||
}
|
||||
else {
|
||||
bindDeclaration(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes, /*isBlockScopeContainer*/ true);
|
||||
if (state === ModuleInstanceState.ConstEnumOnly) {
|
||||
// mark value module as module that contains only enums
|
||||
node.symbol.constEnumOnlyModule = true;
|
||||
let currentModuleIsConstEnumOnly = state === ModuleInstanceState.ConstEnumOnly;
|
||||
if (node.symbol.constEnumOnlyModule === undefined) {
|
||||
// non-merged case - use the current state
|
||||
node.symbol.constEnumOnlyModule = currentModuleIsConstEnumOnly;
|
||||
}
|
||||
else if (node.symbol.constEnumOnlyModule) {
|
||||
// const only value module was merged with instantiated module - reset flag
|
||||
node.symbol.constEnumOnlyModule = false;
|
||||
else {
|
||||
// merged case: module is const enum only if all its pieces are non-instantiated or const enum
|
||||
node.symbol.constEnumOnlyModule = node.symbol.constEnumOnlyModule && currentModuleIsConstEnumOnly;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -529,7 +530,7 @@ module ts {
|
||||
bindChildren(node, 0, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.ExportAssignment:
|
||||
if ((<ExportAssignment>node).expression.kind === SyntaxKind.Identifier) {
|
||||
if ((<ExportAssignment>node).expression && (<ExportAssignment>node).expression.kind === SyntaxKind.Identifier) {
|
||||
// An export default clause with an identifier exports all meanings of that identifier
|
||||
declareSymbol(container.symbol.exports, container.symbol, <Declaration>node, SymbolFlags.Alias, SymbolFlags.AliasExcludes);
|
||||
}
|
||||
|
||||
+307
-138
@@ -79,8 +79,7 @@ module ts {
|
||||
let emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
let anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
let noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
let inferenceFailureType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
|
||||
|
||||
let anySignature = createSignature(undefined, undefined, emptyArray, anyType, 0, false, false);
|
||||
let unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, 0, false, false);
|
||||
|
||||
@@ -446,7 +445,7 @@ module ts {
|
||||
let declaration = forEach(result.declarations, d => isBlockOrCatchScoped(d) ? d : undefined);
|
||||
|
||||
Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined");
|
||||
|
||||
|
||||
// first check if usage is lexically located after the declaration
|
||||
let isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation);
|
||||
if (!isUsedBeforeDeclaration) {
|
||||
@@ -463,7 +462,7 @@ module ts {
|
||||
|
||||
if (variableDeclaration.parent.parent.kind === SyntaxKind.VariableStatement ||
|
||||
variableDeclaration.parent.parent.kind === SyntaxKind.ForStatement) {
|
||||
// variable statement/for statement case,
|
||||
// variable statement/for statement case,
|
||||
// use site should not be inside variable declaration (initializer of declaration or binding element)
|
||||
isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container);
|
||||
}
|
||||
@@ -495,6 +494,19 @@ module ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
function getAnyImportSyntax(node: Node): AnyImportSyntax {
|
||||
if (isAliasSymbolDeclaration(node)) {
|
||||
if (node.kind === SyntaxKind.ImportEqualsDeclaration) {
|
||||
return <ImportEqualsDeclaration>node;
|
||||
}
|
||||
|
||||
while (node && node.kind !== SyntaxKind.ImportDeclaration) {
|
||||
node = node.parent;
|
||||
}
|
||||
return <ImportDeclaration>node;
|
||||
}
|
||||
}
|
||||
|
||||
function getDeclarationOfAliasSymbol(symbol: Symbol): Declaration {
|
||||
return forEach(symbol.declarations, d => isAliasSymbolDeclaration(d) ? d : undefined);
|
||||
}
|
||||
@@ -592,7 +604,7 @@ module ts {
|
||||
}
|
||||
|
||||
function getTargetOfExportAssignment(node: ExportAssignment): Symbol {
|
||||
return resolveEntityName(<Identifier>node.expression, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace);
|
||||
return node.expression && resolveEntityName(<Identifier>node.expression, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace);
|
||||
}
|
||||
|
||||
function getTargetOfImportDeclaration(node: Declaration): Symbol {
|
||||
@@ -652,7 +664,7 @@ module ts {
|
||||
if (!links.referenced) {
|
||||
links.referenced = true;
|
||||
let node = getDeclarationOfAliasSymbol(symbol);
|
||||
if (node.kind === SyntaxKind.ExportAssignment) {
|
||||
if (node.kind === SyntaxKind.ExportAssignment && (<ExportAssignment>node).expression) {
|
||||
// export default <symbol>
|
||||
checkExpressionCached((<ExportAssignment>node).expression);
|
||||
}
|
||||
@@ -1141,7 +1153,7 @@ module ts {
|
||||
}
|
||||
|
||||
function hasVisibleDeclarations(symbol: Symbol): SymbolVisibilityResult {
|
||||
let aliasesToMakeVisible: ImportEqualsDeclaration[];
|
||||
let aliasesToMakeVisible: AnyImportSyntax[];
|
||||
if (forEach(symbol.declarations, declaration => !getIsDeclarationVisible(declaration))) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -1151,17 +1163,19 @@ module ts {
|
||||
if (!isDeclarationVisible(declaration)) {
|
||||
// Mark the unexported alias as visible if its parent is visible
|
||||
// because these kind of aliases can be used to name types in declaration file
|
||||
if (declaration.kind === SyntaxKind.ImportEqualsDeclaration &&
|
||||
!(declaration.flags & NodeFlags.Export) &&
|
||||
isDeclarationVisible(<Declaration>declaration.parent)) {
|
||||
|
||||
var anyImportSyntax = getAnyImportSyntax(declaration);
|
||||
if (anyImportSyntax &&
|
||||
!(anyImportSyntax.flags & NodeFlags.Export) && // import clause without export
|
||||
isDeclarationVisible(<Declaration>anyImportSyntax.parent)) {
|
||||
getNodeLinks(declaration).isVisible = true;
|
||||
if (aliasesToMakeVisible) {
|
||||
if (!contains(aliasesToMakeVisible, declaration)) {
|
||||
aliasesToMakeVisible.push(<ImportEqualsDeclaration>declaration);
|
||||
if (!contains(aliasesToMakeVisible, anyImportSyntax)) {
|
||||
aliasesToMakeVisible.push(anyImportSyntax);
|
||||
}
|
||||
}
|
||||
else {
|
||||
aliasesToMakeVisible = [<ImportEqualsDeclaration>declaration];
|
||||
aliasesToMakeVisible = [anyImportSyntax];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1785,8 +1799,15 @@ module ts {
|
||||
|
||||
function determineIfDeclarationIsVisible() {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.BindingElement:
|
||||
return isDeclarationVisible(<Declaration>node.parent.parent);
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
if (isBindingPattern(node.name) &&
|
||||
!(<BindingPattern>node.name).elements.length) {
|
||||
// If the binding pattern is empty, this variable declaration is not visible
|
||||
return false;
|
||||
}
|
||||
// Otherwise fall through
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
@@ -1798,7 +1819,7 @@ module ts {
|
||||
// If the node is not exported or it is not ambient module element (except import declaration)
|
||||
if (!(getCombinedNodeFlags(node) & NodeFlags.Export) &&
|
||||
!(node.kind !== SyntaxKind.ImportEqualsDeclaration && parent.kind !== SyntaxKind.SourceFile && isInAmbientContext(parent))) {
|
||||
return isGlobalSourceFile(parent) || isUsedInExportAssignment(node);
|
||||
return isGlobalSourceFile(parent);
|
||||
}
|
||||
// Exported members/ambient module elements (exception import declaration) are visible if parent is visible
|
||||
return isDeclarationVisible(<Declaration>parent);
|
||||
@@ -1831,6 +1852,13 @@ module ts {
|
||||
case SyntaxKind.ParenthesizedType:
|
||||
return isDeclarationVisible(<Declaration>node.parent);
|
||||
|
||||
// Default binding, import specifier and namespace import is visible
|
||||
// only on demand so by default it is not visible
|
||||
case SyntaxKind.ImportClause:
|
||||
case SyntaxKind.NamespaceImport:
|
||||
case SyntaxKind.ImportSpecifier:
|
||||
return false;
|
||||
|
||||
// Type parameters are always visible
|
||||
case SyntaxKind.TypeParameter:
|
||||
// Source file is always visible
|
||||
@@ -1851,6 +1879,40 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function collectLinkedAliases(node: Identifier): Node[]{
|
||||
var exportSymbol: Symbol;
|
||||
if (node.parent && node.parent.kind === SyntaxKind.ExportAssignment) {
|
||||
exportSymbol = resolveName(node.parent, node.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace, Diagnostics.Cannot_find_name_0, node);
|
||||
}
|
||||
else if (node.parent.kind === SyntaxKind.ExportSpecifier) {
|
||||
exportSymbol = getTargetOfExportSpecifier(<ExportSpecifier>node.parent);
|
||||
}
|
||||
var result: Node[] = [];
|
||||
if (exportSymbol) {
|
||||
buildVisibleNodeList(exportSymbol.declarations);
|
||||
}
|
||||
return result;
|
||||
|
||||
function buildVisibleNodeList(declarations: Declaration[]) {
|
||||
forEach(declarations, declaration => {
|
||||
getNodeLinks(declaration).isVisible = true;
|
||||
var resultNode = getAnyImportSyntax(declaration) || declaration;
|
||||
if (!contains(result, resultNode)) {
|
||||
result.push(resultNode);
|
||||
}
|
||||
|
||||
if (isInternalModuleImportEqualsDeclaration(declaration)) {
|
||||
// Add the referenced top container visible
|
||||
var internalModuleReference = <Identifier | QualifiedName>(<ImportEqualsDeclaration>declaration).moduleReference;
|
||||
var firstIdentifier = getFirstIdentifier(internalModuleReference);
|
||||
var importSymbol = resolveName(declaration, firstIdentifier.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace,
|
||||
Diagnostics.Cannot_find_name_0, firstIdentifier);
|
||||
buildVisibleNodeList(importSymbol.declarations);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getRootDeclaration(node: Node): Node {
|
||||
while (node.kind === SyntaxKind.BindingElement) {
|
||||
node = node.parent.parent;
|
||||
@@ -2091,7 +2153,16 @@ module ts {
|
||||
}
|
||||
// Handle export default expressions
|
||||
if (declaration.kind === SyntaxKind.ExportAssignment) {
|
||||
return links.type = checkExpression((<ExportAssignment>declaration).expression);
|
||||
var exportAssignment = <ExportAssignment>declaration;
|
||||
if (exportAssignment.expression) {
|
||||
return links.type = checkExpression(exportAssignment.expression);
|
||||
}
|
||||
else if (exportAssignment.type) {
|
||||
return links.type = getTypeFromTypeNode(exportAssignment.type);
|
||||
}
|
||||
else {
|
||||
return links.type = anyType;
|
||||
}
|
||||
}
|
||||
// Handle variable, parameter or property
|
||||
links.type = resolvingType;
|
||||
@@ -3531,6 +3602,7 @@ module ts {
|
||||
return t => {
|
||||
for (let i = 0; i < context.typeParameters.length; i++) {
|
||||
if (t === context.typeParameters[i]) {
|
||||
context.inferences[i].isFixed = true;
|
||||
return getInferredType(context, i);
|
||||
}
|
||||
}
|
||||
@@ -4389,8 +4461,11 @@ module ts {
|
||||
}
|
||||
|
||||
function reportNoCommonSupertypeError(types: Type[], errorLocation: Node, errorMessageChainHead: DiagnosticMessageChain): void {
|
||||
// The downfallType/bestSupertypeDownfallType is the first type that caused a particular candidate
|
||||
// to not be the common supertype. So if it weren't for this one downfallType (and possibly others),
|
||||
// the type in question could have been the common supertype.
|
||||
let bestSupertype: Type;
|
||||
let bestSupertypeDownfallType: Type; // The type that caused bestSupertype not to be the common supertype
|
||||
let bestSupertypeDownfallType: Type;
|
||||
let bestSupertypeScore = 0;
|
||||
|
||||
for (let i = 0; i < types.length; i++) {
|
||||
@@ -4405,6 +4480,8 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
Debug.assert(!!downfallType, "If there is no common supertype, each type should have a downfallType");
|
||||
|
||||
if (score > bestSupertypeScore) {
|
||||
bestSupertype = types[i];
|
||||
bestSupertypeDownfallType = downfallType;
|
||||
@@ -4438,7 +4515,7 @@ module ts {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a Type was written as a tuple type literal.
|
||||
* Check if a Type was written as a tuple type literal.
|
||||
* Prefer using isTupleLikeType() unless the use of `elementTypes` is required.
|
||||
*/
|
||||
function isTupleType(type: Type): boolean {
|
||||
@@ -4587,13 +4664,12 @@ module ts {
|
||||
function createInferenceContext(typeParameters: TypeParameter[], inferUnionTypes: boolean): InferenceContext {
|
||||
let inferences: TypeInferences[] = [];
|
||||
for (let unused of typeParameters) {
|
||||
inferences.push({ primary: undefined, secondary: undefined });
|
||||
inferences.push({ primary: undefined, secondary: undefined, isFixed: false });
|
||||
}
|
||||
return {
|
||||
typeParameters: typeParameters,
|
||||
inferUnionTypes: inferUnionTypes,
|
||||
inferenceCount: 0,
|
||||
inferences: inferences,
|
||||
typeParameters,
|
||||
inferUnionTypes,
|
||||
inferences,
|
||||
inferredTypes: new Array(typeParameters.length),
|
||||
};
|
||||
}
|
||||
@@ -4639,11 +4715,21 @@ module ts {
|
||||
for (let i = 0; i < typeParameters.length; i++) {
|
||||
if (target === typeParameters[i]) {
|
||||
let inferences = context.inferences[i];
|
||||
let candidates = inferiority ?
|
||||
inferences.secondary || (inferences.secondary = []) :
|
||||
inferences.primary || (inferences.primary = []);
|
||||
if (!contains(candidates, source)) candidates.push(source);
|
||||
break;
|
||||
if (!inferences.isFixed) {
|
||||
// Any inferences that are made to a type parameter in a union type are inferior
|
||||
// to inferences made to a flat (non-union) type. This is because if we infer to
|
||||
// T | string[], we really don't know if we should be inferring to T or not (because
|
||||
// the correct constituent on the target side could be string[]). Therefore, we put
|
||||
// such inferior inferences into a secondary bucket, and only use them if the primary
|
||||
// bucket is empty.
|
||||
let candidates = inferiority ?
|
||||
inferences.secondary || (inferences.secondary = []) :
|
||||
inferences.primary || (inferences.primary = []);
|
||||
if (!contains(candidates, source)) {
|
||||
candidates.push(source);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4749,21 +4835,35 @@ module ts {
|
||||
|
||||
function getInferredType(context: InferenceContext, index: number): Type {
|
||||
let inferredType = context.inferredTypes[index];
|
||||
let inferenceSucceeded: boolean;
|
||||
if (!inferredType) {
|
||||
let inferences = getInferenceCandidates(context, index);
|
||||
if (inferences.length) {
|
||||
// Infer widened union or supertype, or the undefined type for no common supertype
|
||||
// Infer widened union or supertype, or the unknown type for no common supertype
|
||||
let unionOrSuperType = context.inferUnionTypes ? getUnionType(inferences) : getCommonSupertype(inferences);
|
||||
inferredType = unionOrSuperType ? getWidenedType(unionOrSuperType) : inferenceFailureType;
|
||||
inferredType = unionOrSuperType ? getWidenedType(unionOrSuperType) : unknownType;
|
||||
inferenceSucceeded = !!unionOrSuperType;
|
||||
}
|
||||
else {
|
||||
// Infer the empty object type when no inferences were made
|
||||
// Infer the empty object type when no inferences were made. It is important to remember that
|
||||
// in this case, inference still succeeds, meaning there is no error for not having inference
|
||||
// candidates. An inference error only occurs when there are *conflicting* candidates, i.e.
|
||||
// candidates with no common supertype.
|
||||
inferredType = emptyObjectType;
|
||||
inferenceSucceeded = true;
|
||||
}
|
||||
if (inferredType !== inferenceFailureType) {
|
||||
|
||||
// Only do the constraint check if inference succeeded (to prevent cascading errors)
|
||||
if (inferenceSucceeded) {
|
||||
let constraint = getConstraintOfTypeParameter(context.typeParameters[index]);
|
||||
inferredType = constraint && !isTypeAssignableTo(inferredType, constraint) ? constraint : inferredType;
|
||||
}
|
||||
else if (context.failedTypeParameterIndex === undefined || context.failedTypeParameterIndex > index) {
|
||||
// If inference failed, it is necessary to record the index of the failed type parameter (the one we are on).
|
||||
// It might be that inference has already failed on a later type parameter on a previous call to inferTypeArguments.
|
||||
// So if this failure is on preceding type parameter, this type parameter is the new failure index.
|
||||
context.failedTypeParameterIndex = index;
|
||||
}
|
||||
context.inferredTypes[index] = inferredType;
|
||||
}
|
||||
return inferredType;
|
||||
@@ -6360,11 +6460,32 @@ module ts {
|
||||
return getSignatureInstantiation(signature, getInferredTypes(context));
|
||||
}
|
||||
|
||||
function inferTypeArguments(signature: Signature, args: Expression[], excludeArgument: boolean[]): InferenceContext {
|
||||
function inferTypeArguments(signature: Signature, args: Expression[], excludeArgument: boolean[], context: InferenceContext): void {
|
||||
let typeParameters = signature.typeParameters;
|
||||
let context = createInferenceContext(typeParameters, /*inferUnionTypes*/ false);
|
||||
let inferenceMapper = createInferenceMapper(context);
|
||||
|
||||
// Clear out all the inference results from the last time inferTypeArguments was called on this context
|
||||
for (let i = 0; i < typeParameters.length; i++) {
|
||||
// As an optimization, we don't have to clear (and later recompute) inferred types
|
||||
// for type parameters that have already been fixed on the previous call to inferTypeArguments.
|
||||
// It would be just as correct to reset all of them. But then we'd be repeating the same work
|
||||
// for the type parameters that were fixed, namely the work done by getInferredType.
|
||||
if (!context.inferences[i].isFixed) {
|
||||
context.inferredTypes[i] = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
// On this call to inferTypeArguments, we may get more inferences for certain type parameters that were not
|
||||
// fixed last time. This means that a type parameter that failed inference last time may succeed this time,
|
||||
// or vice versa. Therefore, the failedTypeParameterIndex is useless if it points to an unfixed type parameter,
|
||||
// because it may change. So here we reset it. However, getInferredType will not revisit any type parameters
|
||||
// that were previously fixed. So if a fixed type parameter failed previously, it will fail again because
|
||||
// it will contain the exact same set of inferences. So if we reset the index from a fixed type parameter,
|
||||
// we will lose information that we won't recover this time around.
|
||||
if (context.failedTypeParameterIndex !== undefined && !context.inferences[context.failedTypeParameterIndex].isFixed) {
|
||||
context.failedTypeParameterIndex = undefined;
|
||||
}
|
||||
|
||||
// We perform two passes over the arguments. In the first pass we infer from all arguments, but use
|
||||
// wildcards for all context sensitive function expressions.
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
@@ -6399,18 +6520,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
let inferredTypes = getInferredTypes(context);
|
||||
// Inference has failed if the inferenceFailureType type is in list of inferences
|
||||
context.failedTypeParameterIndex = indexOf(inferredTypes, inferenceFailureType);
|
||||
|
||||
// Wipe out the inferenceFailureType from the array so that error recovery can work properly
|
||||
for (let i = 0; i < inferredTypes.length; i++) {
|
||||
if (inferredTypes[i] === inferenceFailureType) {
|
||||
inferredTypes[i] = unknownType;
|
||||
}
|
||||
}
|
||||
|
||||
return context;
|
||||
getInferredTypes(context);
|
||||
}
|
||||
|
||||
function checkTypeArguments(signature: Signature, typeArguments: TypeNode[], typeArgumentResultTypes: Type[], reportErrors: boolean): boolean {
|
||||
@@ -6644,15 +6754,17 @@ module ts {
|
||||
return resolveErrorCall(node);
|
||||
|
||||
function chooseOverload(candidates: Signature[], relation: Map<RelationComparisonResult>) {
|
||||
for (let current of candidates) {
|
||||
if (!hasCorrectArity(node, args, current)) {
|
||||
for (let originalCandidate of candidates) {
|
||||
if (!hasCorrectArity(node, args, originalCandidate)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let originalCandidate = current;
|
||||
let inferenceResult: InferenceContext;
|
||||
|
||||
let candidate: Signature;
|
||||
let typeArgumentsAreValid: boolean;
|
||||
let inferenceContext = originalCandidate.typeParameters
|
||||
? createInferenceContext(originalCandidate.typeParameters, /*inferUnionTypes*/ false)
|
||||
: undefined;
|
||||
|
||||
while (true) {
|
||||
candidate = originalCandidate;
|
||||
if (candidate.typeParameters) {
|
||||
@@ -6662,9 +6774,9 @@ module ts {
|
||||
typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, /*reportErrors*/ false)
|
||||
}
|
||||
else {
|
||||
inferenceResult = inferTypeArguments(candidate, args, excludeArgument);
|
||||
typeArgumentsAreValid = inferenceResult.failedTypeParameterIndex < 0;
|
||||
typeArgumentTypes = inferenceResult.inferredTypes;
|
||||
inferTypeArguments(candidate, args, excludeArgument, inferenceContext);
|
||||
typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined;
|
||||
typeArgumentTypes = inferenceContext.inferredTypes;
|
||||
}
|
||||
if (!typeArgumentsAreValid) {
|
||||
break;
|
||||
@@ -6694,7 +6806,7 @@ module ts {
|
||||
else {
|
||||
candidateForTypeArgumentError = originalCandidate;
|
||||
if (!typeArguments) {
|
||||
resultOfFailedInference = inferenceResult;
|
||||
resultOfFailedInference = inferenceContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8660,36 +8772,48 @@ module ts {
|
||||
// const x = 0; // localDeclarationSymbol obtained after name resolution will correspond to this declaration
|
||||
// let x = 0; // symbol for this declaration will be 'symbol'
|
||||
// }
|
||||
if (node.initializer && (getCombinedNodeFlags(node) & NodeFlags.BlockScoped) === 0) {
|
||||
let symbol = getSymbolOfNode(node);
|
||||
if (symbol.flags & SymbolFlags.FunctionScopedVariable) {
|
||||
let localDeclarationSymbol = resolveName(node, (<Identifier>node.name).text, SymbolFlags.Variable, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined);
|
||||
if (localDeclarationSymbol &&
|
||||
localDeclarationSymbol !== symbol &&
|
||||
localDeclarationSymbol.flags & SymbolFlags.BlockScopedVariable) {
|
||||
if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & NodeFlags.BlockScoped) {
|
||||
|
||||
let varDeclList = getAncestor(localDeclarationSymbol.valueDeclaration, SyntaxKind.VariableDeclarationList);
|
||||
let container =
|
||||
varDeclList.parent.kind === SyntaxKind.VariableStatement &&
|
||||
varDeclList.parent.parent;
|
||||
// skip block-scoped variables and parameters
|
||||
if ((getCombinedNodeFlags(node) & NodeFlags.BlockScoped) !== 0 || isParameterDeclaration(node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// names of block-scoped and function scoped variables can collide only
|
||||
// if block scoped variable is defined in the function\module\source file scope (because of variable hoisting)
|
||||
let namesShareScope =
|
||||
container &&
|
||||
(container.kind === SyntaxKind.Block && isFunctionLike(container.parent) ||
|
||||
(container.kind === SyntaxKind.ModuleBlock && container.kind === SyntaxKind.ModuleDeclaration) ||
|
||||
container.kind === SyntaxKind.SourceFile);
|
||||
// skip variable declarations that don't have initializers
|
||||
// NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern
|
||||
// so we'll always treat binding elements as initialized
|
||||
if (node.kind === SyntaxKind.VariableDeclaration && !node.initializer) {
|
||||
return;
|
||||
}
|
||||
|
||||
// here we know that function scoped variable is shadowed by block scoped one
|
||||
// if they are defined in the same scope - binder has already reported redeclaration error
|
||||
// otherwise if variable has an initializer - show error that initialization will fail
|
||||
// since LHS will be block scoped name instead of function scoped
|
||||
if (!namesShareScope) {
|
||||
let name = symbolToString(localDeclarationSymbol);
|
||||
error(node, Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name);
|
||||
}
|
||||
var symbol = getSymbolOfNode(node);
|
||||
if (symbol.flags & SymbolFlags.FunctionScopedVariable) {
|
||||
let localDeclarationSymbol = resolveName(node, (<Identifier>node.name).text, SymbolFlags.Variable, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined);
|
||||
if (localDeclarationSymbol &&
|
||||
localDeclarationSymbol !== symbol &&
|
||||
localDeclarationSymbol.flags & SymbolFlags.BlockScopedVariable) {
|
||||
if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & NodeFlags.BlockScoped) {
|
||||
let varDeclList = getAncestor(localDeclarationSymbol.valueDeclaration, SyntaxKind.VariableDeclarationList);
|
||||
let container =
|
||||
varDeclList.parent.kind === SyntaxKind.VariableStatement && varDeclList.parent.parent
|
||||
? varDeclList.parent.parent
|
||||
: undefined;
|
||||
|
||||
// names of block-scoped and function scoped variables can collide only
|
||||
// if block scoped variable is defined in the function\module\source file scope (because of variable hoisting)
|
||||
let namesShareScope =
|
||||
container &&
|
||||
(container.kind === SyntaxKind.Block && isFunctionLike(container.parent) ||
|
||||
container.kind === SyntaxKind.ModuleBlock ||
|
||||
container.kind === SyntaxKind.ModuleDeclaration ||
|
||||
container.kind === SyntaxKind.SourceFile);
|
||||
|
||||
// here we know that function scoped variable is shadowed by block scoped one
|
||||
// if they are defined in the same scope - binder has already reported redeclaration error
|
||||
// otherwise if variable has an initializer - show error that initialization will fail
|
||||
// since LHS will be block scoped name instead of function scoped
|
||||
if (!namesShareScope) {
|
||||
let name = symbolToString(localDeclarationSymbol);
|
||||
error(node, Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9106,7 +9230,7 @@ module ts {
|
||||
*/
|
||||
function checkElementTypeOfArrayOrString(arrayOrStringType: Type, expressionForError: Expression): Type {
|
||||
Debug.assert(languageVersion < ScriptTarget.ES6);
|
||||
|
||||
|
||||
// After we remove all types that are StringLike, we will know if there was a string constituent
|
||||
// based on whether the remaining type is the same as the initial type.
|
||||
let arrayType = removeTypesFromUnionType(arrayOrStringType, TypeFlags.StringLike, /*isTypeOfKind*/ true, /*allowEmptyUnionResult*/ true);
|
||||
@@ -9707,7 +9831,7 @@ module ts {
|
||||
}
|
||||
let initializer = member.initializer;
|
||||
if (initializer) {
|
||||
autoValue = getConstantValueForEnumMemberInitializer(initializer, enumIsConst);
|
||||
autoValue = getConstantValueForEnumMemberInitializer(initializer);
|
||||
if (autoValue === undefined) {
|
||||
if (enumIsConst) {
|
||||
error(initializer, Diagnostics.In_const_enum_declarations_member_initializer_must_be_constant_expression);
|
||||
@@ -9742,7 +9866,7 @@ module ts {
|
||||
nodeLinks.flags |= NodeCheckFlags.EnumValuesComputed;
|
||||
}
|
||||
|
||||
function getConstantValueForEnumMemberInitializer(initializer: Expression, enumIsConst: boolean): number {
|
||||
function getConstantValueForEnumMemberInitializer(initializer: Expression): number {
|
||||
return evalConstant(initializer);
|
||||
|
||||
function evalConstant(e: Node): number {
|
||||
@@ -9755,14 +9879,10 @@ module ts {
|
||||
switch ((<PrefixUnaryExpression>e).operator) {
|
||||
case SyntaxKind.PlusToken: return value;
|
||||
case SyntaxKind.MinusToken: return -value;
|
||||
case SyntaxKind.TildeToken: return enumIsConst ? ~value : undefined;
|
||||
case SyntaxKind.TildeToken: return ~value;
|
||||
}
|
||||
return undefined;
|
||||
case SyntaxKind.BinaryExpression:
|
||||
if (!enumIsConst) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let left = evalConstant((<BinaryExpression>e).left);
|
||||
if (left === undefined) {
|
||||
return undefined;
|
||||
@@ -9788,14 +9908,10 @@ module ts {
|
||||
case SyntaxKind.NumericLiteral:
|
||||
return +(<LiteralExpression>e).text;
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
return enumIsConst ? evalConstant((<ParenthesizedExpression>e).expression) : undefined;
|
||||
return evalConstant((<ParenthesizedExpression>e).expression);
|
||||
case SyntaxKind.Identifier:
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
if (!enumIsConst) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let member = initializer.parent;
|
||||
let currentType = getTypeOfSymbol(getSymbolOfNode(member.parent));
|
||||
let enumType: Type;
|
||||
@@ -9808,19 +9924,37 @@ module ts {
|
||||
propertyName = (<Identifier>e).text;
|
||||
}
|
||||
else {
|
||||
let expression: Expression;
|
||||
if (e.kind === SyntaxKind.ElementAccessExpression) {
|
||||
if ((<ElementAccessExpression>e).argumentExpression === undefined ||
|
||||
(<ElementAccessExpression>e).argumentExpression.kind !== SyntaxKind.StringLiteral) {
|
||||
return undefined;
|
||||
}
|
||||
enumType = getTypeOfNode((<ElementAccessExpression>e).expression);
|
||||
expression = (<ElementAccessExpression>e).expression;
|
||||
propertyName = (<LiteralExpression>(<ElementAccessExpression>e).argumentExpression).text;
|
||||
}
|
||||
else {
|
||||
enumType = getTypeOfNode((<PropertyAccessExpression>e).expression);
|
||||
expression = (<PropertyAccessExpression>e).expression;
|
||||
propertyName = (<PropertyAccessExpression>e).name.text;
|
||||
}
|
||||
if (enumType !== currentType) {
|
||||
|
||||
// expression part in ElementAccess\PropertyAccess should be either identifier or dottedName
|
||||
var current = expression;
|
||||
while (current) {
|
||||
if (current.kind === SyntaxKind.Identifier) {
|
||||
break;
|
||||
}
|
||||
else if (current.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
current = (<ElementAccessExpression>current).expression;
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
enumType = checkExpression(expression);
|
||||
// allow references to constant members of other enums
|
||||
if (!(enumType.symbol && (enumType.symbol.flags & SymbolFlags.Enum))) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
@@ -9828,10 +9962,12 @@ module ts {
|
||||
if (propertyName === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let property = getPropertyOfObjectType(enumType, propertyName);
|
||||
if (!property || !(property.flags & SymbolFlags.EnumMember)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let propertyDecl = property.valueDeclaration;
|
||||
// self references are illegal
|
||||
if (member === propertyDecl) {
|
||||
@@ -9842,6 +9978,7 @@ module ts {
|
||||
if (!isDefinedBefore(propertyDecl, member)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return <number>getNodeLinks(propertyDecl).enumMemberValue;
|
||||
}
|
||||
}
|
||||
@@ -10058,6 +10195,12 @@ module ts {
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (languageVersion >= ScriptTarget.ES6) {
|
||||
// Import equals declaration is deprecated in es6 or above
|
||||
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10098,13 +10241,27 @@ module ts {
|
||||
if (!checkGrammarModifiers(node) && (node.flags & NodeFlags.Modifier)) {
|
||||
grammarErrorOnFirstToken(node, Diagnostics.An_export_assignment_cannot_have_modifiers);
|
||||
}
|
||||
if (node.expression.kind === SyntaxKind.Identifier) {
|
||||
markExportAsReferenced(node);
|
||||
if (node.expression) {
|
||||
if (node.expression.kind === SyntaxKind.Identifier) {
|
||||
markExportAsReferenced(node);
|
||||
}
|
||||
else {
|
||||
checkExpressionCached(node.expression);
|
||||
}
|
||||
}
|
||||
else {
|
||||
checkExpressionCached(node.expression);
|
||||
if (node.type) {
|
||||
checkSourceElement(node.type);
|
||||
if (!isInAmbientContext(node)) {
|
||||
grammarErrorOnFirstToken(node.type, Diagnostics.A_type_annotation_on_an_export_statement_is_only_allowed_in_an_ambient_external_module_declaration);
|
||||
}
|
||||
}
|
||||
|
||||
checkExternalModuleExports(container);
|
||||
|
||||
if (node.isExportEquals && languageVersion >= ScriptTarget.ES6) {
|
||||
// export assignment is deprecated in es6 or above
|
||||
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead);
|
||||
}
|
||||
}
|
||||
|
||||
function getModuleStatements(node: Declaration): ModuleElement[] {
|
||||
@@ -10944,7 +11101,7 @@ module ts {
|
||||
}
|
||||
|
||||
function generateNameForExportAssignment(node: ExportAssignment) {
|
||||
if (node.expression.kind !== SyntaxKind.Identifier) {
|
||||
if (node.expression && node.expression.kind !== SyntaxKind.Identifier) {
|
||||
assignGeneratedName(node, makeUniqueName("default"));
|
||||
}
|
||||
}
|
||||
@@ -10982,7 +11139,15 @@ module ts {
|
||||
|
||||
function getExportNameSubstitution(symbol: Symbol, location: Node): string {
|
||||
if (isExternalModuleSymbol(symbol.parent)) {
|
||||
return "exports." + unescapeIdentifier(symbol.name);
|
||||
var symbolName = unescapeIdentifier(symbol.name);
|
||||
// If this is es6 or higher, just use the name of the export
|
||||
// no need to qualify it.
|
||||
if (languageVersion >= ScriptTarget.ES6) {
|
||||
return symbolName;
|
||||
}
|
||||
else {
|
||||
return "exports." + symbolName;
|
||||
}
|
||||
}
|
||||
let node = location;
|
||||
let containerSymbol = getParentOfSymbol(symbol);
|
||||
@@ -11010,7 +11175,7 @@ module ts {
|
||||
return getExportNameSubstitution(exportSymbol, node.parent);
|
||||
}
|
||||
// Named imports from ES6 import declarations are rewritten
|
||||
if (symbol.flags & SymbolFlags.Alias) {
|
||||
if (symbol.flags & SymbolFlags.Alias && languageVersion < ScriptTarget.ES6) {
|
||||
return getAliasNameSubstitution(symbol);
|
||||
}
|
||||
}
|
||||
@@ -11028,7 +11193,7 @@ module ts {
|
||||
let exportClause = (<ExportDeclaration>node).exportClause;
|
||||
return exportClause && forEach(exportClause.elements, isValueAliasDeclaration);
|
||||
case SyntaxKind.ExportAssignment:
|
||||
return (<ExportAssignment>node).expression.kind === SyntaxKind.Identifier ? isAliasResolvedToValue(getSymbolOfNode(node)) : true;
|
||||
return (<ExportAssignment>node).expression && (<ExportAssignment>node).expression.kind === SyntaxKind.Identifier ? isAliasResolvedToValue(getSymbolOfNode(node)) : true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -11058,7 +11223,6 @@ module ts {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return forEachChild(node, isReferencedAliasDeclaration);
|
||||
}
|
||||
|
||||
function isImplementationOfOverload(node: FunctionLikeDeclaration) {
|
||||
@@ -11098,10 +11262,9 @@ module ts {
|
||||
|
||||
let symbol = getNodeLinks(node).resolvedSymbol;
|
||||
if (symbol && (symbol.flags & SymbolFlags.EnumMember)) {
|
||||
let declaration = symbol.valueDeclaration;
|
||||
let constantValue: number;
|
||||
if (declaration.kind === SyntaxKind.EnumMember) {
|
||||
return getEnumMemberValue(<EnumMember>declaration);
|
||||
// inline property\index accesses only for const enums
|
||||
if (isConstEnumDeclaration(symbol.valueDeclaration.parent)) {
|
||||
return getEnumMemberValue(<EnumMember>symbol.valueDeclaration);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11123,6 +11286,11 @@ module ts {
|
||||
getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags);
|
||||
}
|
||||
|
||||
function writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) {
|
||||
var type = getTypeOfExpression(expr);
|
||||
getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);
|
||||
}
|
||||
|
||||
function isUnknownIdentifier(location: Node, name: string): boolean {
|
||||
Debug.assert(!nodeIsSynthesized(location), "isUnknownIdentifier called with a synthesized location");
|
||||
return !resolveName(location, name, SymbolFlags.Value, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined) &&
|
||||
@@ -11132,26 +11300,11 @@ module ts {
|
||||
function getBlockScopedVariableId(n: Identifier): number {
|
||||
Debug.assert(!nodeIsSynthesized(n));
|
||||
|
||||
// ignore name parts of property access expressions
|
||||
if (n.parent.kind === SyntaxKind.PropertyAccessExpression &&
|
||||
(<PropertyAccessExpression>n.parent).name === n) {
|
||||
return undefined;
|
||||
}
|
||||
let isVariableDeclarationOrBindingElement =
|
||||
n.parent.kind === SyntaxKind.BindingElement || (n.parent.kind === SyntaxKind.VariableDeclaration && (<VariableDeclaration>n.parent).name === n);
|
||||
|
||||
// ignore property names in object binding patterns
|
||||
if (n.parent.kind === SyntaxKind.BindingElement &&
|
||||
(<BindingElement>n.parent).propertyName === n) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// for names in variable declarations and binding elements try to short circuit and fetch symbol from the node
|
||||
let declarationSymbol: Symbol =
|
||||
(n.parent.kind === SyntaxKind.VariableDeclaration && (<VariableDeclaration>n.parent).name === n) ||
|
||||
n.parent.kind === SyntaxKind.BindingElement
|
||||
? getSymbolOfNode(n.parent)
|
||||
: undefined;
|
||||
|
||||
let symbol = declarationSymbol ||
|
||||
let symbol =
|
||||
(isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) ||
|
||||
getNodeLinks(n).resolvedSymbol ||
|
||||
resolveName(n, n.text, SymbolFlags.Value | SymbolFlags.Alias, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined);
|
||||
|
||||
@@ -11181,10 +11334,12 @@ module ts {
|
||||
isImplementationOfOverload,
|
||||
writeTypeOfDeclaration,
|
||||
writeReturnTypeOfSignatureDeclaration,
|
||||
writeTypeOfExpression,
|
||||
isSymbolAccessible,
|
||||
isEntityNameVisible,
|
||||
getConstantValue,
|
||||
isUnknownIdentifier,
|
||||
collectLinkedAliases,
|
||||
getBlockScopedVariableId,
|
||||
};
|
||||
}
|
||||
@@ -11383,16 +11538,15 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function checkGrammarTypeParameterList(node: FunctionLikeDeclaration, typeParameters: NodeArray<TypeParameterDeclaration>): boolean {
|
||||
function checkGrammarTypeParameterList(node: FunctionLikeDeclaration, typeParameters: NodeArray<TypeParameterDeclaration>, file: SourceFile): boolean {
|
||||
if (checkGrammarForDisallowedTrailingComma(typeParameters)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (typeParameters && typeParameters.length === 0) {
|
||||
let start = typeParameters.pos - "<".length;
|
||||
let sourceFile = getSourceFileOfNode(node);
|
||||
let end = skipTrivia(sourceFile.text, typeParameters.end) + ">".length;
|
||||
return grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.Type_parameter_list_cannot_be_empty);
|
||||
let end = skipTrivia(file.text, typeParameters.end) + ">".length;
|
||||
return grammarErrorAtPos(file, start, end - start, Diagnostics.Type_parameter_list_cannot_be_empty);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11436,7 +11590,21 @@ module ts {
|
||||
|
||||
function checkGrammarFunctionLikeDeclaration(node: FunctionLikeDeclaration): boolean {
|
||||
// Prevent cascading error by short-circuit
|
||||
return checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters) || checkGrammarParameterList(node.parameters);
|
||||
let file = getSourceFileOfNode(node);
|
||||
return checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters, file) ||
|
||||
checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file);
|
||||
}
|
||||
|
||||
function checkGrammarArrowFunction(node: FunctionLikeDeclaration, file: SourceFile): boolean {
|
||||
if (node.kind === SyntaxKind.ArrowFunction) {
|
||||
let arrowFunction = <ArrowFunction>node;
|
||||
let startLine = getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line;
|
||||
let endLine = getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line;
|
||||
if (startLine !== endLine) {
|
||||
return grammarErrorOnNode(arrowFunction.equalsGreaterThanToken, Diagnostics.Line_terminator_not_permitted_before_arrow);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function checkGrammarIndexSignatureParameters(node: SignatureDeclaration): boolean {
|
||||
@@ -12109,8 +12277,8 @@ module ts {
|
||||
}
|
||||
|
||||
function checkGrammarTopLevelElementForRequiredDeclareModifier(node: Node): boolean {
|
||||
// A declare modifier is required for any top level .d.ts declaration except export=, interfaces and imports:
|
||||
// categories:
|
||||
// A declare modifier is required for any top level .d.ts declaration except export=, export default,
|
||||
// interfaces and imports categories:
|
||||
//
|
||||
// DeclarationElement:
|
||||
// ExportAssignment
|
||||
@@ -12124,7 +12292,8 @@ module ts {
|
||||
node.kind === SyntaxKind.ImportEqualsDeclaration ||
|
||||
node.kind === SyntaxKind.ExportDeclaration ||
|
||||
node.kind === SyntaxKind.ExportAssignment ||
|
||||
(node.flags & NodeFlags.Ambient)) {
|
||||
(node.flags & NodeFlags.Ambient) ||
|
||||
(node.flags & (NodeFlags.Export | NodeFlags.Default))) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -122,8 +122,10 @@ module ts {
|
||||
}
|
||||
|
||||
export function addRange<T>(to: T[], from: T[]): void {
|
||||
for (let v of from) {
|
||||
to.push(v);
|
||||
if (to && from) {
|
||||
for (let v of from) {
|
||||
to.push(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -157,6 +157,11 @@ module ts {
|
||||
Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: DiagnosticCategory.Error, key: "Catch clause variable cannot have an initializer." },
|
||||
An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: DiagnosticCategory.Error, key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." },
|
||||
Unterminated_Unicode_escape_sequence: { code: 1199, category: DiagnosticCategory.Error, key: "Unterminated Unicode escape sequence." },
|
||||
Line_terminator_not_permitted_before_arrow: { code: 1200, category: DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." },
|
||||
A_type_annotation_on_an_export_statement_is_only_allowed_in_an_ambient_external_module_declaration: { code: 1201, category: DiagnosticCategory.Error, key: "A type annotation on an export statement is only allowed in an ambient external module declaration." },
|
||||
Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." },
|
||||
Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." },
|
||||
Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher: { code: 1204, category: DiagnosticCategory.Error, key: "Cannot compile external modules into amd or commonjs when targeting es6 or higher." },
|
||||
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
|
||||
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
|
||||
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
|
||||
@@ -339,9 +344,10 @@ module ts {
|
||||
Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: DiagnosticCategory.Error, key: "Cannot redeclare identifier '{0}' in catch clause" },
|
||||
Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: DiagnosticCategory.Error, key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." },
|
||||
Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: DiagnosticCategory.Error, key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." },
|
||||
Type_0_is_not_an_array_type_or_a_string_type: { code: 2461, category: DiagnosticCategory.Error, key: "Type '{0}' is not an array type or a string type." },
|
||||
External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2496, category: DiagnosticCategory.Error, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." },
|
||||
External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2497, category: DiagnosticCategory.Error, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." },
|
||||
Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: DiagnosticCategory.Error, key: "Type '{0}' is not an array type or a string type." },
|
||||
The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 2496, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." },
|
||||
External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: DiagnosticCategory.Error, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." },
|
||||
External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: DiagnosticCategory.Error, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." },
|
||||
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
|
||||
@@ -411,6 +417,7 @@ module ts {
|
||||
Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." },
|
||||
Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using private name '{1}'." },
|
||||
Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: DiagnosticCategory.Error, key: "Exported type alias '{0}' has or is using private name '{1}'." },
|
||||
Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: DiagnosticCategory.Error, key: "Default export of the module has or is using private name '{0}'." },
|
||||
Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { code: 4091, category: DiagnosticCategory.Error, key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." },
|
||||
The_current_host_does_not_support_the_0_option: { code: 5001, category: DiagnosticCategory.Error, key: "The current host does not support the '{0}' option." },
|
||||
Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: DiagnosticCategory.Error, key: "Cannot find the common subdirectory path for the input files." },
|
||||
@@ -488,6 +495,5 @@ module ts {
|
||||
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: DiagnosticCategory.Error, key: "You cannot rename elements that are defined in the standard TypeScript library." },
|
||||
yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." },
|
||||
Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." },
|
||||
The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." },
|
||||
};
|
||||
}
|
||||
@@ -617,8 +617,29 @@
|
||||
},
|
||||
"Unterminated Unicode escape sequence.": {
|
||||
"category": "Error",
|
||||
"code": 1199
|
||||
"code": 1199
|
||||
},
|
||||
"Line terminator not permitted before arrow.": {
|
||||
"category": "Error",
|
||||
"code": 1200
|
||||
},
|
||||
"A type annotation on an export statement is only allowed in an ambient external module declaration.": {
|
||||
"category": "Error",
|
||||
"code": 1201
|
||||
},
|
||||
"Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead.": {
|
||||
"category": "Error",
|
||||
"code": 1202
|
||||
},
|
||||
"Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.": {
|
||||
"category": "Error",
|
||||
"code": 1203
|
||||
},
|
||||
"Cannot compile external modules into amd or commonjs when targeting es6 or higher.": {
|
||||
"category": "Error",
|
||||
"code": 1204
|
||||
},
|
||||
|
||||
"Duplicate identifier '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2300
|
||||
@@ -1349,16 +1370,20 @@
|
||||
},
|
||||
"Type '{0}' is not an array type or a string type.": {
|
||||
"category": "Error",
|
||||
"code": 2461
|
||||
"code": 2495
|
||||
},
|
||||
"External module '{0}' resolves to a non-module entity and cannot be imported using this construct.": {
|
||||
"The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.": {
|
||||
"category": "Error",
|
||||
"code": 2496
|
||||
},
|
||||
"External module '{0}' uses 'export =' and cannot be used with 'export *'.": {
|
||||
"External module '{0}' resolves to a non-module entity and cannot be imported using this construct.": {
|
||||
"category": "Error",
|
||||
"code": 2497
|
||||
},
|
||||
"External module '{0}' uses 'export =' and cannot be used with 'export *'.": {
|
||||
"category": "Error",
|
||||
"code": 2498
|
||||
},
|
||||
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
@@ -1636,6 +1661,10 @@
|
||||
"category": "Error",
|
||||
"code": 4081
|
||||
},
|
||||
"Default export of the module has or is using private name '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 4082
|
||||
},
|
||||
"Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.": {
|
||||
"category": "Error",
|
||||
"code": 4091
|
||||
@@ -1944,9 +1973,5 @@
|
||||
"Generators are not currently supported.": {
|
||||
"category": "Error",
|
||||
"code": 9001
|
||||
},
|
||||
"The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.": {
|
||||
"category": "Error",
|
||||
"code": 9002
|
||||
}
|
||||
}
|
||||
|
||||
+655
-1810
File diff suppressed because it is too large
Load Diff
+186
-172
File diff suppressed because it is too large
Load Diff
+60
-32
@@ -2,13 +2,15 @@
|
||||
/// <reference path="emitter.ts" />
|
||||
|
||||
module ts {
|
||||
/* @internal */ export let programTime = 0;
|
||||
/* @internal */ export let emitTime = 0;
|
||||
/* @internal */ export let ioReadTime = 0;
|
||||
/* @internal */ export let ioWriteTime = 0;
|
||||
|
||||
/** The version of the TypeScript compiler release */
|
||||
export let version = "1.5.0.0";
|
||||
|
||||
export function createCompilerHost(options: CompilerOptions): CompilerHost {
|
||||
export function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost {
|
||||
let currentDirectory: string;
|
||||
let existingDirectories: Map<boolean> = {};
|
||||
|
||||
@@ -36,33 +38,34 @@ module ts {
|
||||
}
|
||||
text = "";
|
||||
}
|
||||
return text !== undefined ? createSourceFile(fileName, text, languageVersion, setParentNodes) : undefined;
|
||||
}
|
||||
|
||||
return text !== undefined ? createSourceFile(fileName, text, languageVersion) : undefined;
|
||||
function directoryExists(directoryPath: string): boolean {
|
||||
if (hasProperty(existingDirectories, directoryPath)) {
|
||||
return true;
|
||||
}
|
||||
if (sys.directoryExists(directoryPath)) {
|
||||
existingDirectories[directoryPath] = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function ensureDirectoriesExist(directoryPath: string) {
|
||||
if (directoryPath.length > getRootLength(directoryPath) && !directoryExists(directoryPath)) {
|
||||
let parentDirectory = getDirectoryPath(directoryPath);
|
||||
ensureDirectoriesExist(parentDirectory);
|
||||
sys.createDirectory(directoryPath);
|
||||
}
|
||||
}
|
||||
|
||||
function writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) {
|
||||
function directoryExists(directoryPath: string): boolean {
|
||||
if (hasProperty(existingDirectories, directoryPath)) {
|
||||
return true;
|
||||
}
|
||||
if (sys.directoryExists(directoryPath)) {
|
||||
existingDirectories[directoryPath] = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function ensureDirectoriesExist(directoryPath: string) {
|
||||
if (directoryPath.length > getRootLength(directoryPath) && !directoryExists(directoryPath)) {
|
||||
let parentDirectory = getDirectoryPath(directoryPath);
|
||||
ensureDirectoriesExist(parentDirectory);
|
||||
sys.createDirectory(directoryPath);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
var start = new Date().getTime();
|
||||
ensureDirectoriesExist(getDirectoryPath(normalizePath(fileName)));
|
||||
sys.writeFile(fileName, data, writeByteOrderMark);
|
||||
ioWriteTime += new Date().getTime() - start;
|
||||
}
|
||||
catch (e) {
|
||||
if (onError) {
|
||||
@@ -84,6 +87,11 @@ module ts {
|
||||
|
||||
export function getPreEmitDiagnostics(program: Program): Diagnostic[] {
|
||||
let diagnostics = program.getSyntacticDiagnostics().concat(program.getGlobalDiagnostics()).concat(program.getSemanticDiagnostics());
|
||||
|
||||
if (program.getCompilerOptions().declaration) {
|
||||
diagnostics.concat(program.getDeclarationDiagnostics());
|
||||
}
|
||||
|
||||
return sortAndDeduplicateDiagnostics(diagnostics);
|
||||
}
|
||||
|
||||
@@ -120,16 +128,19 @@ module ts {
|
||||
let diagnostics = createDiagnosticCollection();
|
||||
let seenNoDefaultLib = options.noLib;
|
||||
let commonSourceDirectory: string;
|
||||
host = host || createCompilerHost(options);
|
||||
let diagnosticsProducingTypeChecker: TypeChecker;
|
||||
let noDiagnosticsTypeChecker: TypeChecker;
|
||||
|
||||
let start = new Date().getTime();
|
||||
|
||||
host = host || createCompilerHost(options);
|
||||
forEach(rootNames, name => processRootFile(name, false));
|
||||
if (!seenNoDefaultLib) {
|
||||
processRootFile(host.getDefaultLibFileName(options), true);
|
||||
}
|
||||
verifyCompilerOptions();
|
||||
|
||||
let diagnosticsProducingTypeChecker: TypeChecker;
|
||||
let noDiagnosticsTypeChecker: TypeChecker;
|
||||
programTime += new Date().getTime() - start;
|
||||
|
||||
program = {
|
||||
getSourceFile: getSourceFile,
|
||||
@@ -172,11 +183,6 @@ module ts {
|
||||
return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = createTypeChecker(program, /*produceDiagnostics:*/ false));
|
||||
}
|
||||
|
||||
function getDeclarationDiagnostics(targetSourceFile: SourceFile): Diagnostic[] {
|
||||
let resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(targetSourceFile);
|
||||
return ts.getDeclarationDiagnostics(getEmitHost(), resolver, targetSourceFile);
|
||||
}
|
||||
|
||||
function emit(sourceFile?: SourceFile, writeFileCallback?: WriteFileCallback): EmitResult {
|
||||
// If the noEmitOnError flag is set, then check if we have any errors so far. If so,
|
||||
// immediately bail out.
|
||||
@@ -226,6 +232,10 @@ module ts {
|
||||
return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile);
|
||||
}
|
||||
|
||||
function getDeclarationDiagnostics(sourceFile?: SourceFile): Diagnostic[] {
|
||||
return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile);
|
||||
}
|
||||
|
||||
function getSyntacticDiagnosticsForFile(sourceFile: SourceFile): Diagnostic[] {
|
||||
return sourceFile.parseDiagnostics;
|
||||
}
|
||||
@@ -241,6 +251,15 @@ module ts {
|
||||
return bindDiagnostics.concat(checkDiagnostics).concat(programDiagnostics);
|
||||
}
|
||||
|
||||
function getDeclarationDiagnosticsForFile(sourceFile: SourceFile): Diagnostic[] {
|
||||
if (!isDeclarationFile(sourceFile)) {
|
||||
let resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile);
|
||||
// Don't actually write any files since we're just getting diagnostics.
|
||||
var writeFile: WriteFileCallback = () => { };
|
||||
return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile);
|
||||
}
|
||||
}
|
||||
|
||||
function getGlobalDiagnostics(): Diagnostic[] {
|
||||
let typeChecker = getDiagnosticsProducingTypeChecker();
|
||||
|
||||
@@ -430,11 +449,20 @@ module ts {
|
||||
return;
|
||||
}
|
||||
|
||||
let languageVersion = options.target || ScriptTarget.ES3;
|
||||
|
||||
let firstExternalModuleSourceFile = forEach(files, f => isExternalModule(f) ? f : undefined);
|
||||
if (firstExternalModuleSourceFile && !options.module) {
|
||||
// We cannot use createDiagnosticFromNode because nodes do not have parents yet
|
||||
let span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator);
|
||||
diagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided));
|
||||
if (!options.module && languageVersion < ScriptTarget.ES6) {
|
||||
// We cannot use createDiagnosticFromNode because nodes do not have parents yet
|
||||
let span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator);
|
||||
diagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided));
|
||||
}
|
||||
}
|
||||
|
||||
// Cannot specify module gen target when in es6 or above
|
||||
if (options.module && languageVersion >= ScriptTarget.ES6) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher));
|
||||
}
|
||||
|
||||
// there has to be common source directory if user specified --outdir || --sourcRoot
|
||||
|
||||
+43
-11
@@ -318,13 +318,38 @@ module ts {
|
||||
let hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
export function isWhiteSpace(ch: number): boolean {
|
||||
return ch === CharacterCodes.space || ch === CharacterCodes.tab || ch === CharacterCodes.verticalTab || ch === CharacterCodes.formFeed ||
|
||||
ch === CharacterCodes.nonBreakingSpace || ch === CharacterCodes.ogham || ch >= CharacterCodes.enQuad && ch <= CharacterCodes.zeroWidthSpace ||
|
||||
ch === CharacterCodes.narrowNoBreakSpace || ch === CharacterCodes.mathematicalSpace || ch === CharacterCodes.ideographicSpace || ch === CharacterCodes.byteOrderMark;
|
||||
// Note: nextLine is in the Zs space, and should be considered to be a whitespace.
|
||||
// It is explicitly not a line-break as it isn't in the exact set specified by EcmaScript.
|
||||
return ch === CharacterCodes.space ||
|
||||
ch === CharacterCodes.tab ||
|
||||
ch === CharacterCodes.verticalTab ||
|
||||
ch === CharacterCodes.formFeed ||
|
||||
ch === CharacterCodes.nonBreakingSpace ||
|
||||
ch === CharacterCodes.nextLine ||
|
||||
ch === CharacterCodes.ogham ||
|
||||
ch >= CharacterCodes.enQuad && ch <= CharacterCodes.zeroWidthSpace ||
|
||||
ch === CharacterCodes.narrowNoBreakSpace ||
|
||||
ch === CharacterCodes.mathematicalSpace ||
|
||||
ch === CharacterCodes.ideographicSpace ||
|
||||
ch === CharacterCodes.byteOrderMark;
|
||||
}
|
||||
|
||||
export function isLineBreak(ch: number): boolean {
|
||||
return ch === CharacterCodes.lineFeed || ch === CharacterCodes.carriageReturn || ch === CharacterCodes.lineSeparator || ch === CharacterCodes.paragraphSeparator || ch === CharacterCodes.nextLine;
|
||||
// ES5 7.3:
|
||||
// The ECMAScript line terminator characters are listed in Table 3.
|
||||
// Table 3 — Line Terminator Characters
|
||||
// Code Unit Value Name Formal Name
|
||||
// \u000A Line Feed <LF>
|
||||
// \u000D Carriage Return <CR>
|
||||
// \u2028 Line separator <LS>
|
||||
// \u2029 Paragraph separator <PS>
|
||||
// Only the characters in Table 3 are treated as line terminators. Other new line or line
|
||||
// breaking characters are treated as white space but not as line terminators.
|
||||
|
||||
return ch === CharacterCodes.lineFeed ||
|
||||
ch === CharacterCodes.carriageReturn ||
|
||||
ch === CharacterCodes.lineSeparator ||
|
||||
ch === CharacterCodes.paragraphSeparator;
|
||||
}
|
||||
|
||||
function isDigit(ch: number): boolean {
|
||||
@@ -455,11 +480,13 @@ module ts {
|
||||
return pos;
|
||||
}
|
||||
|
||||
// Extract comments from the given source text starting at the given position. If trailing is false, whitespace is skipped until
|
||||
// the first line break and comments between that location and the next token are returned. If trailing is true, comments occurring
|
||||
// between the given position and the next line break are returned. The return value is an array containing a TextRange for each
|
||||
// comment. Single-line comment ranges include the beginning '//' characters but not the ending line break. Multi-line comment
|
||||
// ranges include the beginning '/* and ending '*/' characters. The return value is undefined if no comments were found.
|
||||
// Extract comments from the given source text starting at the given position. If trailing is
|
||||
// false, whitespace is skipped until the first line break and comments between that location
|
||||
// and the next token are returned.If trailing is true, comments occurring between the given
|
||||
// position and the next line break are returned.The return value is an array containing a
|
||||
// TextRange for each comment. Single-line comment ranges include the beginning '//' characters
|
||||
// but not the ending line break. Multi - line comment ranges include the beginning '/* and
|
||||
// ending '*/' characters.The return value is undefined if no comments were found.
|
||||
function getCommentRanges(text: string, pos: number, trailing: boolean): CommentRange[] {
|
||||
let result: CommentRange[];
|
||||
let collecting = trailing || pos === 0;
|
||||
@@ -467,7 +494,9 @@ module ts {
|
||||
let ch = text.charCodeAt(pos);
|
||||
switch (ch) {
|
||||
case CharacterCodes.carriageReturn:
|
||||
if (text.charCodeAt(pos + 1) === CharacterCodes.lineFeed) pos++;
|
||||
if (text.charCodeAt(pos + 1) === CharacterCodes.lineFeed) {
|
||||
pos++;
|
||||
}
|
||||
case CharacterCodes.lineFeed:
|
||||
pos++;
|
||||
if (trailing) {
|
||||
@@ -509,7 +538,10 @@ module ts {
|
||||
}
|
||||
}
|
||||
if (collecting) {
|
||||
if (!result) result = [];
|
||||
if (!result) {
|
||||
result = [];
|
||||
}
|
||||
|
||||
result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine });
|
||||
}
|
||||
continue;
|
||||
|
||||
+15
-24
@@ -320,22 +320,16 @@ module ts {
|
||||
}
|
||||
|
||||
function compile(fileNames: string[], compilerOptions: CompilerOptions, compilerHost: CompilerHost) {
|
||||
ts.ioReadTime = 0;
|
||||
ts.parseTime = 0;
|
||||
ts.bindTime = 0;
|
||||
ts.checkTime = 0;
|
||||
ts.emitTime = 0;
|
||||
|
||||
var start = new Date().getTime();
|
||||
ioReadTime = 0;
|
||||
ioWriteTime = 0;
|
||||
programTime = 0;
|
||||
bindTime = 0;
|
||||
checkTime = 0;
|
||||
emitTime = 0;
|
||||
|
||||
var program = createProgram(fileNames, compilerOptions, compilerHost);
|
||||
var programTime = new Date().getTime() - start;
|
||||
|
||||
var exitStatus = compileProgram();
|
||||
|
||||
var end = new Date().getTime() - start;
|
||||
var compileTime = end - programTime;
|
||||
|
||||
if (compilerOptions.listFiles) {
|
||||
forEach(program.getSourceFiles(), file => {
|
||||
sys.write(file.fileName + sys.newLine);
|
||||
@@ -356,19 +350,16 @@ module ts {
|
||||
}
|
||||
|
||||
// Individual component times.
|
||||
// Note: we output 'programTime' as parseTime to match the tsc 1.3 behavior. tsc 1.3
|
||||
// measured parse time along with read IO as a single counter. We preserve that
|
||||
// behavior so we can accurately compare times. For actual parse times (in isolation)
|
||||
// is reported below.
|
||||
// Note: To match the behavior of previous versions of the compiler, the reported parse time includes
|
||||
// I/O read time and processing time for triple-slash references and module imports, and the reported
|
||||
// emit time includes I/O write time. We preserve this behavior so we can accurately compare times.
|
||||
reportTimeStatistic("I/O read", ioReadTime);
|
||||
reportTimeStatistic("I/O write", ioWriteTime);
|
||||
reportTimeStatistic("Parse time", programTime);
|
||||
reportTimeStatistic("Bind time", ts.bindTime);
|
||||
reportTimeStatistic("Check time", ts.checkTime);
|
||||
reportTimeStatistic("Emit time", ts.emitTime);
|
||||
|
||||
reportTimeStatistic("Parse time w/o IO", ts.parseTime);
|
||||
reportTimeStatistic("IO read", ts.ioReadTime);
|
||||
reportTimeStatistic("Compile time", compileTime);
|
||||
reportTimeStatistic("Total time", end);
|
||||
reportTimeStatistic("Bind time", bindTime);
|
||||
reportTimeStatistic("Check time", checkTime);
|
||||
reportTimeStatistic("Emit time", emitTime);
|
||||
reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime);
|
||||
}
|
||||
|
||||
return { program, exitStatus };
|
||||
|
||||
+39
-26
@@ -330,7 +330,7 @@ module ts {
|
||||
|
||||
// If the parser encountered an error when parsing the code that created this node. Note
|
||||
// the parser only sets this directly on the node it creates right after encountering the
|
||||
// error.
|
||||
// error.
|
||||
ThisNodeHasError = 1 << 4,
|
||||
|
||||
// Context flags set directly by the parser.
|
||||
@@ -338,7 +338,7 @@ module ts {
|
||||
|
||||
// Context flags computed by aggregating child flags upwards.
|
||||
|
||||
// Used during incremental parsing to determine if this node or any of its children had an
|
||||
// Used during incremental parsing to determine if this node or any of its children had an
|
||||
// error. Computed only once and then cached.
|
||||
ThisNodeOrAnySubNodesHasError = 1 << 5,
|
||||
|
||||
@@ -355,7 +355,7 @@ module ts {
|
||||
export interface Node extends TextRange {
|
||||
kind: SyntaxKind;
|
||||
flags: NodeFlags;
|
||||
// Specific context the parser was in when this node was created. Normally undefined.
|
||||
// Specific context the parser was in when this node was created. Normally undefined.
|
||||
// Only set when the parser was in some interesting context (like async/yield).
|
||||
parserContextFlags?: ParserContextFlags;
|
||||
modifiers?: ModifiersArray; // Array of modifiers
|
||||
@@ -525,7 +525,7 @@ module ts {
|
||||
body?: Block;
|
||||
}
|
||||
|
||||
// See the comment on MethodDeclaration for the intuition behind AccessorDeclaration being a
|
||||
// See the comment on MethodDeclaration for the intuition behind AccessorDeclaration being a
|
||||
// ClassElement and an ObjectLiteralElement.
|
||||
export interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
|
||||
_accessorDeclarationBrand: any;
|
||||
@@ -576,12 +576,12 @@ module ts {
|
||||
|
||||
export interface StringLiteralTypeNode extends LiteralExpression, TypeNode { }
|
||||
|
||||
// Note: 'brands' in our syntax nodes serve to give us a small amount of nominal typing.
|
||||
// Note: 'brands' in our syntax nodes serve to give us a small amount of nominal typing.
|
||||
// Consider 'Expression'. Without the brand, 'Expression' is actually no different
|
||||
// (structurally) than 'Node'. Because of this you can pass any Node to a function that
|
||||
// takes an Expression without any error. By using the 'brands' we ensure that the type
|
||||
// checker actually thinks you have something of the right type. Note: the brands are
|
||||
// never actually given values. At runtime they have zero cost.
|
||||
// checker actually thinks you have something of the right type. Note: the brands are
|
||||
// never actually given values. At runtime they have zero cost.
|
||||
|
||||
export interface Expression extends Node {
|
||||
_expressionBrand: any;
|
||||
@@ -654,6 +654,10 @@ module ts {
|
||||
body: Block | Expression; // Required, whereas the member inherited from FunctionDeclaration is optional
|
||||
}
|
||||
|
||||
export interface ArrowFunction extends Expression, FunctionLikeDeclaration {
|
||||
equalsGreaterThanToken: Node;
|
||||
}
|
||||
|
||||
// The text property of a LiteralExpression stores the interpreted value of the literal in text form. For a StringLiteral,
|
||||
// or any literal of a template, this means quotes have been removed and escapes have been converted to actual characters.
|
||||
// For a NumericLiteral, the stored value is the toString() representation of the number. For example 1, 1.00, and 1e0 are all stored as just "1".
|
||||
@@ -736,7 +740,7 @@ module ts {
|
||||
}
|
||||
|
||||
export interface VariableStatement extends Statement {
|
||||
declarationList: VariableDeclarationList;
|
||||
declarationList: VariableDeclarationList;
|
||||
}
|
||||
|
||||
export interface ExpressionStatement extends Statement {
|
||||
@@ -904,7 +908,7 @@ module ts {
|
||||
moduleSpecifier: Expression;
|
||||
}
|
||||
|
||||
// In case of:
|
||||
// In case of:
|
||||
// import d from "mod" => name = d, namedBinding = undefined
|
||||
// import * as ns from "mod" => name = undefined, namedBinding: NamespaceImport = { name: ns }
|
||||
// import d, * as ns from "mod" => name = d, namedBinding: NamespaceImport = { name: ns }
|
||||
@@ -941,7 +945,8 @@ module ts {
|
||||
|
||||
export interface ExportAssignment extends Declaration, ModuleElement {
|
||||
isExportEquals?: boolean;
|
||||
expression: Expression;
|
||||
expression?: Expression;
|
||||
type?: TypeNode;
|
||||
}
|
||||
|
||||
export interface FileReference extends TextRange {
|
||||
@@ -970,7 +975,7 @@ module ts {
|
||||
externalModuleIndicator: Node;
|
||||
languageVersion: ScriptTarget;
|
||||
identifiers: Map<string>;
|
||||
|
||||
|
||||
/* @internal */ nodeCount: number;
|
||||
/* @internal */ identifierCount: number;
|
||||
/* @internal */ symbolCount: number;
|
||||
@@ -978,10 +983,10 @@ module ts {
|
||||
// File level diagnostics reported by the parser (includes diagnostics about /// references
|
||||
// as well as code diagnostics).
|
||||
/* @internal */ parseDiagnostics: Diagnostic[];
|
||||
|
||||
|
||||
// File level diagnostics reported by the binder.
|
||||
/* @internal */ bindDiagnostics: Diagnostic[];
|
||||
|
||||
|
||||
// Stores a line map for the file.
|
||||
// This field should never be used directly to obtain line map, use getLineMap function instead.
|
||||
/* @internal */ lineMap: number[];
|
||||
@@ -1001,14 +1006,14 @@ module ts {
|
||||
getSourceFiles(): SourceFile[];
|
||||
|
||||
/**
|
||||
* Emits the javascript and declaration files. If targetSourceFile is not specified, then
|
||||
* the javascript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the javascript and declaration for that
|
||||
* specific file will be generated.
|
||||
* Emits the JavaScript and declaration files. If targetSourceFile is not specified, then
|
||||
* the JavaScript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the JavaScript and declaration for that
|
||||
* specific file will be generated.
|
||||
*
|
||||
* If writeFile is not specified then the writeFile callback from the compiler host will be
|
||||
* used for writing the javascript and declaration files. Otherwise, the writeFile parameter
|
||||
* will be invoked when writing the javascript and declaration files.
|
||||
* used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter
|
||||
* will be invoked when writing the JavaScript and declaration files.
|
||||
*/
|
||||
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult;
|
||||
|
||||
@@ -1022,7 +1027,7 @@ module ts {
|
||||
|
||||
getCommonSourceDirectory(): string;
|
||||
|
||||
// For testing purposes only. Should not be used by any other consumers (including the
|
||||
// For testing purposes only. Should not be used by any other consumers (including the
|
||||
// language service).
|
||||
/* @internal */ getDiagnosticsProducingTypeChecker(): TypeChecker;
|
||||
|
||||
@@ -1059,7 +1064,7 @@ module ts {
|
||||
// when -version or -help was provided, or this was a normal compilation, no diagnostics
|
||||
// were produced, and all outputs were generated successfully.
|
||||
Success = 0,
|
||||
|
||||
|
||||
// Diagnostics were produced and because of them no code was generated.
|
||||
DiagnosticsPresent_OutputsSkipped = 1,
|
||||
|
||||
@@ -1169,12 +1174,12 @@ module ts {
|
||||
|
||||
// Write symbols's type argument if it is instantiated symbol
|
||||
// eg. class C<T> { p: T } <-- Show p as C<T>.p here
|
||||
// var a: C<number>;
|
||||
// var a: C<number>;
|
||||
// var p = a.p; <--- Here p is property of C<number> so show it as C<number>.p instead of just C.p
|
||||
WriteTypeParametersOrArguments = 0x00000001,
|
||||
WriteTypeParametersOrArguments = 0x00000001,
|
||||
|
||||
// Use only external alias information to get the symbol name in the given context
|
||||
// eg. module m { export class c { } } import x = m.c;
|
||||
// eg. module m { export class c { } } import x = m.c;
|
||||
// When this flag is specified m.c will be used to refer to the class instead of alias symbol x
|
||||
UseOnlyExternalAliasing = 0x00000002,
|
||||
}
|
||||
@@ -1185,9 +1190,11 @@ module ts {
|
||||
CannotBeNamed
|
||||
}
|
||||
|
||||
export type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
|
||||
export interface SymbolVisibilityResult {
|
||||
accessibility: SymbolAccessibility;
|
||||
aliasesToMakeVisible?: ImportEqualsDeclaration[]; // aliases that need to have this symbol visible
|
||||
aliasesToMakeVisible?: AnyImportSyntax[]; // aliases that need to have this symbol visible
|
||||
errorSymbolName?: string; // Optional symbol name that results in error
|
||||
errorNode?: Node; // optional node that results in error
|
||||
}
|
||||
@@ -1204,9 +1211,11 @@ module ts {
|
||||
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
|
||||
getNodeCheckFlags(node: Node): NodeCheckFlags;
|
||||
isDeclarationVisible(node: Declaration): boolean;
|
||||
collectLinkedAliases(node: Identifier): Node[];
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
// Returns the constant value this property access resolves to, or 'undefined' for a non-constant
|
||||
@@ -1483,11 +1492,15 @@ module ts {
|
||||
(t: Type): Type;
|
||||
}
|
||||
|
||||
// @internal
|
||||
export interface TypeInferences {
|
||||
primary: Type[]; // Inferences made directly to a type parameter
|
||||
secondary: Type[]; // Inferences made to a type parameter in a union type
|
||||
isFixed: boolean; // Whether the type parameter is fixed, as defined in section 4.12.2 of the TypeScript spec
|
||||
// If a type parameter is fixed, no more inferences can be made for the type parameter
|
||||
}
|
||||
|
||||
// @internal
|
||||
export interface InferenceContext {
|
||||
typeParameters: TypeParameter[]; // Type parameters for which inferences are made
|
||||
inferUnionTypes: boolean; // Infer union types for disjoint candidates (otherwise undefinedType)
|
||||
@@ -1779,7 +1792,7 @@ module ts {
|
||||
// Gets a count of how many times this collection has been modified. This value changes
|
||||
// each time 'add' is called (regardless of whether or not an equivalent diagnostic was
|
||||
// already in the collection). As such, it can be used as a simple way to tell if any
|
||||
// operation caused diagnostics to be returned by storing and comparing the return value
|
||||
// operation caused diagnostics to be returned by storing and comparing the return value
|
||||
// of this method before/after the operation is performed.
|
||||
getModificationCount(): number;
|
||||
}
|
||||
|
||||
+320
-7
@@ -361,16 +361,16 @@ module ts {
|
||||
return node.kind === SyntaxKind.ExpressionStatement && (<ExpressionStatement>node).expression.kind === SyntaxKind.StringLiteral;
|
||||
}
|
||||
|
||||
export function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode?: SourceFile) {
|
||||
sourceFileOfNode = sourceFileOfNode || getSourceFileOfNode(node);
|
||||
|
||||
export function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode: SourceFile) {
|
||||
// If parameter/type parameter, the prev token trailing comments are part of this node too
|
||||
if (node.kind === SyntaxKind.Parameter || node.kind === SyntaxKind.TypeParameter) {
|
||||
// e.g. (/** blah */ a, /** blah */ b);
|
||||
return concatenate(getTrailingCommentRanges(sourceFileOfNode.text, node.pos),
|
||||
// e.g.: (
|
||||
// /** blah */ a,
|
||||
// /** blah */ b);
|
||||
|
||||
// e.g.: (
|
||||
// /** blah */ a,
|
||||
// /** blah */ b);
|
||||
return concatenate(
|
||||
getTrailingCommentRanges(sourceFileOfNode.text, node.pos),
|
||||
getLeadingCommentRanges(sourceFileOfNode.text, node.pos));
|
||||
}
|
||||
else {
|
||||
@@ -1381,4 +1381,317 @@ module ts {
|
||||
s.replace(nonAsciiCharacters, c => get16BitUnicodeEscapeSequence(c.charCodeAt(0))) :
|
||||
s;
|
||||
}
|
||||
|
||||
export interface EmitTextWriter {
|
||||
write(s: string): void;
|
||||
writeTextOfNode(sourceFile: SourceFile, node: Node): void;
|
||||
writeLine(): void;
|
||||
increaseIndent(): void;
|
||||
decreaseIndent(): void;
|
||||
getText(): string;
|
||||
rawWrite(s: string): void;
|
||||
writeLiteral(s: string): void;
|
||||
getTextPos(): number;
|
||||
getLine(): number;
|
||||
getColumn(): number;
|
||||
getIndent(): number;
|
||||
}
|
||||
|
||||
let indentStrings: string[] = ["", " "];
|
||||
export function getIndentString(level: number) {
|
||||
if (indentStrings[level] === undefined) {
|
||||
indentStrings[level] = getIndentString(level - 1) + indentStrings[1];
|
||||
}
|
||||
return indentStrings[level];
|
||||
}
|
||||
|
||||
export function getIndentSize() {
|
||||
return indentStrings[1].length;
|
||||
}
|
||||
|
||||
export function createTextWriter(newLine: String): EmitTextWriter {
|
||||
let output = "";
|
||||
let indent = 0;
|
||||
let lineStart = true;
|
||||
let lineCount = 0;
|
||||
let linePos = 0;
|
||||
|
||||
function write(s: string) {
|
||||
if (s && s.length) {
|
||||
if (lineStart) {
|
||||
output += getIndentString(indent);
|
||||
lineStart = false;
|
||||
}
|
||||
output += s;
|
||||
}
|
||||
}
|
||||
|
||||
function rawWrite(s: string) {
|
||||
if (s !== undefined) {
|
||||
if (lineStart) {
|
||||
lineStart = false;
|
||||
}
|
||||
output += s;
|
||||
}
|
||||
}
|
||||
|
||||
function writeLiteral(s: string) {
|
||||
if (s && s.length) {
|
||||
write(s);
|
||||
let lineStartsOfS = computeLineStarts(s);
|
||||
if (lineStartsOfS.length > 1) {
|
||||
lineCount = lineCount + lineStartsOfS.length - 1;
|
||||
linePos = output.length - s.length + lineStartsOfS[lineStartsOfS.length - 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function writeLine() {
|
||||
if (!lineStart) {
|
||||
output += newLine;
|
||||
lineCount++;
|
||||
linePos = output.length;
|
||||
lineStart = true;
|
||||
}
|
||||
}
|
||||
|
||||
function writeTextOfNode(sourceFile: SourceFile, node: Node) {
|
||||
write(getSourceTextOfNodeFromSourceFile(sourceFile, node));
|
||||
}
|
||||
|
||||
return {
|
||||
write,
|
||||
rawWrite,
|
||||
writeTextOfNode,
|
||||
writeLiteral,
|
||||
writeLine,
|
||||
increaseIndent: () => indent++,
|
||||
decreaseIndent: () => indent--,
|
||||
getIndent: () => indent,
|
||||
getTextPos: () => output.length,
|
||||
getLine: () => lineCount + 1,
|
||||
getColumn: () => lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1,
|
||||
getText: () => output,
|
||||
};
|
||||
}
|
||||
|
||||
export function getOwnEmitOutputFilePath(sourceFile: SourceFile, host: EmitHost, extension: string) {
|
||||
let compilerOptions = host.getCompilerOptions();
|
||||
let emitOutputFilePathWithoutExtension: string;
|
||||
if (compilerOptions.outDir) {
|
||||
emitOutputFilePathWithoutExtension = removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir));
|
||||
}
|
||||
else {
|
||||
emitOutputFilePathWithoutExtension = removeFileExtension(sourceFile.fileName);
|
||||
}
|
||||
|
||||
return emitOutputFilePathWithoutExtension + extension;
|
||||
}
|
||||
|
||||
export function getSourceFilePathInNewDir(sourceFile: SourceFile, host: EmitHost, newDirPath: string) {
|
||||
let sourceFilePath = getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory());
|
||||
sourceFilePath = sourceFilePath.replace(host.getCommonSourceDirectory(), "");
|
||||
return combinePaths(newDirPath, sourceFilePath);
|
||||
}
|
||||
|
||||
export function writeFile(host: EmitHost, diagnostics: Diagnostic[], fileName: string, data: string, writeByteOrderMark: boolean) {
|
||||
host.writeFile(fileName, data, writeByteOrderMark, hostErrorMessage => {
|
||||
diagnostics.push(createCompilerDiagnostic(Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
});
|
||||
}
|
||||
|
||||
export function getLineOfLocalPosition(currentSourceFile: SourceFile, pos: number) {
|
||||
return getLineAndCharacterOfPosition(currentSourceFile, pos).line;
|
||||
}
|
||||
|
||||
export function getFirstConstructorWithBody(node: ClassDeclaration): ConstructorDeclaration {
|
||||
return forEach(node.members, member => {
|
||||
if (member.kind === SyntaxKind.Constructor && nodeIsPresent((<ConstructorDeclaration>member).body)) {
|
||||
return <ConstructorDeclaration>member;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean {
|
||||
if (!isDeclarationFile(sourceFile)) {
|
||||
if ((isExternalModule(sourceFile) || !compilerOptions.out) && !fileExtensionIs(sourceFile.fileName, ".js")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function getAllAccessorDeclarations(declarations: NodeArray<Declaration>, accessor: AccessorDeclaration) {
|
||||
let firstAccessor: AccessorDeclaration;
|
||||
let getAccessor: AccessorDeclaration;
|
||||
let setAccessor: AccessorDeclaration;
|
||||
if (hasDynamicName(accessor)) {
|
||||
firstAccessor = accessor;
|
||||
if (accessor.kind === SyntaxKind.GetAccessor) {
|
||||
getAccessor = accessor;
|
||||
}
|
||||
else if (accessor.kind === SyntaxKind.SetAccessor) {
|
||||
setAccessor = accessor;
|
||||
}
|
||||
else {
|
||||
Debug.fail("Accessor has wrong kind");
|
||||
}
|
||||
}
|
||||
else {
|
||||
forEach(declarations, (member: Declaration) => {
|
||||
if ((member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor)
|
||||
&& (member.flags & NodeFlags.Static) === (accessor.flags & NodeFlags.Static)) {
|
||||
let memberName = getPropertyNameForPropertyNameNode(member.name);
|
||||
let accessorName = getPropertyNameForPropertyNameNode(accessor.name);
|
||||
if (memberName === accessorName) {
|
||||
if (!firstAccessor) {
|
||||
firstAccessor = <AccessorDeclaration>member;
|
||||
}
|
||||
|
||||
if (member.kind === SyntaxKind.GetAccessor && !getAccessor) {
|
||||
getAccessor = <AccessorDeclaration>member;
|
||||
}
|
||||
|
||||
if (member.kind === SyntaxKind.SetAccessor && !setAccessor) {
|
||||
setAccessor = <AccessorDeclaration>member;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return {
|
||||
firstAccessor,
|
||||
getAccessor,
|
||||
setAccessor
|
||||
};
|
||||
}
|
||||
|
||||
export function emitNewLineBeforeLeadingComments(currentSourceFile: SourceFile, writer: EmitTextWriter, node: TextRange, leadingComments: CommentRange[]) {
|
||||
// If the leading comments start on different line than the start of node, write new line
|
||||
if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos &&
|
||||
getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) {
|
||||
writer.writeLine();
|
||||
}
|
||||
}
|
||||
|
||||
export function emitComments(currentSourceFile: SourceFile, writer: EmitTextWriter, comments: CommentRange[], trailingSeparator: boolean, newLine: string,
|
||||
writeComment: (currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string) => void) {
|
||||
let emitLeadingSpace = !trailingSeparator;
|
||||
forEach(comments, comment => {
|
||||
if (emitLeadingSpace) {
|
||||
writer.write(" ");
|
||||
emitLeadingSpace = false;
|
||||
}
|
||||
writeComment(currentSourceFile, writer, comment, newLine);
|
||||
if (comment.hasTrailingNewLine) {
|
||||
writer.writeLine();
|
||||
}
|
||||
else if (trailingSeparator) {
|
||||
writer.write(" ");
|
||||
}
|
||||
else {
|
||||
// Emit leading space to separate comment during next comment emit
|
||||
emitLeadingSpace = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function writeCommentRange(currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string) {
|
||||
if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) {
|
||||
let firstCommentLineAndCharacter = getLineAndCharacterOfPosition(currentSourceFile, comment.pos);
|
||||
let lineCount = getLineStarts(currentSourceFile).length;
|
||||
let firstCommentLineIndent: number;
|
||||
for (let pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) {
|
||||
let nextLineStart = (currentLine + 1) === lineCount
|
||||
? currentSourceFile.text.length + 1
|
||||
: getStartPositionOfLine(currentLine + 1, currentSourceFile);
|
||||
|
||||
if (pos !== comment.pos) {
|
||||
// If we are not emitting first line, we need to write the spaces to adjust the alignment
|
||||
if (firstCommentLineIndent === undefined) {
|
||||
firstCommentLineIndent = calculateIndent(getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos);
|
||||
}
|
||||
|
||||
// These are number of spaces writer is going to write at current indent
|
||||
let currentWriterIndentSpacing = writer.getIndent() * getIndentSize();
|
||||
|
||||
// Number of spaces we want to be writing
|
||||
// eg: Assume writer indent
|
||||
// module m {
|
||||
// /* starts at character 9 this is line 1
|
||||
// * starts at character pos 4 line --1 = 8 - 8 + 3
|
||||
// More left indented comment */ --2 = 8 - 8 + 2
|
||||
// class c { }
|
||||
// }
|
||||
// module m {
|
||||
// /* this is line 1 -- Assume current writer indent 8
|
||||
// * line --3 = 8 - 4 + 5
|
||||
// More right indented comment */ --4 = 8 - 4 + 11
|
||||
// class c { }
|
||||
// }
|
||||
let spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(pos, nextLineStart);
|
||||
if (spacesToEmit > 0) {
|
||||
let numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize();
|
||||
let indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize());
|
||||
|
||||
// Write indent size string ( in eg 1: = "", 2: "" , 3: string with 8 spaces 4: string with 12 spaces
|
||||
writer.rawWrite(indentSizeSpaceString);
|
||||
|
||||
// Emit the single spaces (in eg: 1: 3 spaces, 2: 2 spaces, 3: 1 space, 4: 3 spaces)
|
||||
while (numberOfSingleSpacesToEmit) {
|
||||
writer.rawWrite(" ");
|
||||
numberOfSingleSpacesToEmit--;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// No spaces to emit write empty string
|
||||
writer.rawWrite("");
|
||||
}
|
||||
}
|
||||
|
||||
// Write the comment line text
|
||||
writeTrimmedCurrentLine(pos, nextLineStart);
|
||||
|
||||
pos = nextLineStart;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Single line comment of style //....
|
||||
writer.write(currentSourceFile.text.substring(comment.pos, comment.end));
|
||||
}
|
||||
|
||||
function writeTrimmedCurrentLine(pos: number, nextLineStart: number) {
|
||||
let end = Math.min(comment.end, nextLineStart - 1);
|
||||
let currentLineText = currentSourceFile.text.substring(pos, end).replace(/^\s+|\s+$/g, '');
|
||||
if (currentLineText) {
|
||||
// trimmed forward and ending spaces text
|
||||
writer.write(currentLineText);
|
||||
if (end !== comment.end) {
|
||||
writer.writeLine();
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Empty string - make sure we write empty line
|
||||
writer.writeLiteral(newLine);
|
||||
}
|
||||
}
|
||||
|
||||
function calculateIndent(pos: number, end: number) {
|
||||
let currentLineIndent = 0;
|
||||
for (; pos < end && isWhiteSpace(currentSourceFile.text.charCodeAt(pos)); pos++) {
|
||||
if (currentSourceFile.text.charCodeAt(pos) === CharacterCodes.tab) {
|
||||
// Tabs = TabSize = indent size and go to next tabStop
|
||||
currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize());
|
||||
}
|
||||
else {
|
||||
// Single space
|
||||
currentLineIndent++;
|
||||
}
|
||||
}
|
||||
|
||||
return currentLineIndent;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -620,7 +620,7 @@ module FourSlash {
|
||||
this.scenarioActions.push('<VerifyCompletionDoesNotContainItem ItemName="' + escapeXmlAttributeValue(symbol) + '" />');
|
||||
|
||||
var members = this.getMemberListAtCaret();
|
||||
if (members.entries.filter(e => e.name === symbol).length !== 0) {
|
||||
if (members && members.entries.filter(e => e.name === symbol).length !== 0) {
|
||||
this.raiseError('Member list did contain ' + symbol);
|
||||
}
|
||||
}
|
||||
@@ -691,7 +691,12 @@ module FourSlash {
|
||||
|
||||
public verifyCompletionListContains(symbol: string, text?: string, documentation?: string, kind?: string) {
|
||||
var completions = this.getCompletionListAtCaret();
|
||||
this.assertItemInCompletionList(completions.entries, symbol, text, documentation, kind);
|
||||
if (completions) {
|
||||
this.assertItemInCompletionList(completions.entries, symbol, text, documentation, kind);
|
||||
}
|
||||
else {
|
||||
this.raiseError(`No completions at position '${ this.currentCaretPosition }' when looking for '${ symbol }'.`);
|
||||
}
|
||||
}
|
||||
|
||||
public verifyCompletionListDoesNotContain(symbol: string) {
|
||||
@@ -699,7 +704,7 @@ module FourSlash {
|
||||
this.scenarioActions.push('<VerifyCompletionDoesNotContainItem ItemName="' + escapeXmlAttributeValue(symbol) + '" />');
|
||||
|
||||
var completions = this.getCompletionListAtCaret();
|
||||
if (completions && completions.entries && completions.entries.filter(e => e.name === symbol).length !== 0) {
|
||||
if (completions && completions.entries.filter(e => e.name === symbol).length !== 0) {
|
||||
this.raiseError('Completion list did contain ' + symbol);
|
||||
}
|
||||
}
|
||||
@@ -1621,8 +1626,9 @@ module FourSlash {
|
||||
this.taoInvalidReason = 'verifyIndentationAtCurrentPosition NYI';
|
||||
|
||||
var actual = this.getIndentation(this.activeFile.fileName, this.currentCaretPosition);
|
||||
if (actual != numberOfSpaces) {
|
||||
this.raiseError('verifyIndentationAtCurrentPosition failed - expected: ' + numberOfSpaces + ', actual: ' + actual);
|
||||
var lineCol = this.getLineColStringAtPosition(this.currentCaretPosition);
|
||||
if (actual !== numberOfSpaces) {
|
||||
this.raiseError('verifyIndentationAtCurrentPosition failed at ' + lineCol + ' - expected: ' + numberOfSpaces + ', actual: ' + actual);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1630,8 +1636,9 @@ module FourSlash {
|
||||
this.taoInvalidReason = 'verifyIndentationAtPosition NYI';
|
||||
|
||||
var actual = this.getIndentation(fileName, position);
|
||||
var lineCol = this.getLineColStringAtPosition(position);
|
||||
if (actual !== numberOfSpaces) {
|
||||
this.raiseError('verifyIndentationAtPosition failed - expected: ' + numberOfSpaces + ', actual: ' + actual);
|
||||
this.raiseError('verifyIndentationAtPosition failed at ' + lineCol + ' - expected: ' + numberOfSpaces + ', actual: ' + actual);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+57
-57
@@ -46,21 +46,21 @@ module ts.server {
|
||||
return lineMap;
|
||||
}
|
||||
|
||||
private lineColToPosition(fileName: string, lineCol: protocol.Location): number {
|
||||
return ts.computePositionOfLineAndCharacter(this.getLineMap(fileName), lineCol.line - 1, lineCol.col - 1);
|
||||
private lineOffsetToPosition(fileName: string, lineOffset: protocol.Location): number {
|
||||
return ts.computePositionOfLineAndCharacter(this.getLineMap(fileName), lineOffset.line - 1, lineOffset.offset - 1);
|
||||
}
|
||||
|
||||
private positionToOneBasedLineCol(fileName: string, position: number): protocol.Location {
|
||||
var lineCol = ts.computeLineAndCharacterOfPosition(this.getLineMap(fileName), position);
|
||||
private positionToOneBasedLineOffset(fileName: string, position: number): protocol.Location {
|
||||
var lineOffset = ts.computeLineAndCharacterOfPosition(this.getLineMap(fileName), position);
|
||||
return {
|
||||
line: lineCol.line + 1,
|
||||
col: lineCol.character + 1
|
||||
line: lineOffset.line + 1,
|
||||
offset: lineOffset.character + 1
|
||||
};
|
||||
}
|
||||
|
||||
private convertCodeEditsToTextChange(fileName: string, codeEdit: protocol.CodeEdit): ts.TextChange {
|
||||
var start = this.lineColToPosition(fileName, codeEdit.start);
|
||||
var end = this.lineColToPosition(fileName, codeEdit.end);
|
||||
var start = this.lineOffsetToPosition(fileName, codeEdit.start);
|
||||
var end = this.lineOffsetToPosition(fileName, codeEdit.end);
|
||||
|
||||
return {
|
||||
span: ts.createTextSpanFromBounds(start, end),
|
||||
@@ -134,15 +134,15 @@ module ts.server {
|
||||
// clear the line map after an edit
|
||||
this.lineMaps[fileName] = undefined;
|
||||
|
||||
var lineCol = this.positionToOneBasedLineCol(fileName, start);
|
||||
var endLineCol = this.positionToOneBasedLineCol(fileName, end);
|
||||
var lineOffset = this.positionToOneBasedLineOffset(fileName, start);
|
||||
var endLineOffset = this.positionToOneBasedLineOffset(fileName, end);
|
||||
|
||||
var args: protocol.ChangeRequestArgs = {
|
||||
file: fileName,
|
||||
line: lineCol.line,
|
||||
col: lineCol.col,
|
||||
endLine: endLineCol.line,
|
||||
endCol: endLineCol.col,
|
||||
line: lineOffset.line,
|
||||
offset: lineOffset.offset,
|
||||
endLine: endLineOffset.line,
|
||||
endOffset: endLineOffset.offset,
|
||||
insertString: newText
|
||||
};
|
||||
|
||||
@@ -150,18 +150,18 @@ module ts.server {
|
||||
}
|
||||
|
||||
getQuickInfoAtPosition(fileName: string, position: number): QuickInfo {
|
||||
var lineCol = this.positionToOneBasedLineCol(fileName, position);
|
||||
var lineOffset = this.positionToOneBasedLineOffset(fileName, position);
|
||||
var args: protocol.FileLocationRequestArgs = {
|
||||
file: fileName,
|
||||
line: lineCol.line,
|
||||
col: lineCol.col
|
||||
line: lineOffset.line,
|
||||
offset: lineOffset.offset
|
||||
};
|
||||
|
||||
var request = this.processRequest<protocol.QuickInfoRequest>(CommandNames.Quickinfo, args);
|
||||
var response = this.processResponse<protocol.QuickInfoResponse>(request);
|
||||
|
||||
var start = this.lineColToPosition(fileName, response.body.start);
|
||||
var end = this.lineColToPosition(fileName, response.body.end);
|
||||
var start = this.lineOffsetToPosition(fileName, response.body.start);
|
||||
var end = this.lineOffsetToPosition(fileName, response.body.end);
|
||||
|
||||
return {
|
||||
kind: response.body.kind,
|
||||
@@ -173,11 +173,11 @@ module ts.server {
|
||||
}
|
||||
|
||||
getCompletionsAtPosition(fileName: string, position: number): CompletionInfo {
|
||||
var lineCol = this.positionToOneBasedLineCol(fileName, position);
|
||||
var lineOffset = this.positionToOneBasedLineOffset(fileName, position);
|
||||
var args: protocol.CompletionsRequestArgs = {
|
||||
file: fileName,
|
||||
line: lineCol.line,
|
||||
col: lineCol.col,
|
||||
line: lineOffset.line,
|
||||
offset: lineOffset.offset,
|
||||
prefix: undefined
|
||||
};
|
||||
|
||||
@@ -194,11 +194,11 @@ module ts.server {
|
||||
}
|
||||
|
||||
getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails {
|
||||
var lineCol = this.positionToOneBasedLineCol(fileName, position);
|
||||
var lineOffset = this.positionToOneBasedLineOffset(fileName, position);
|
||||
var args: protocol.CompletionDetailsRequestArgs = {
|
||||
file: fileName,
|
||||
line: lineCol.line,
|
||||
col: lineCol.col,
|
||||
line: lineOffset.line,
|
||||
offset: lineOffset.offset,
|
||||
entryNames: [entryName]
|
||||
};
|
||||
|
||||
@@ -219,8 +219,8 @@ module ts.server {
|
||||
|
||||
return response.body.map(entry => {
|
||||
var fileName = entry.file;
|
||||
var start = this.lineColToPosition(fileName, entry.start);
|
||||
var end = this.lineColToPosition(fileName, entry.end);
|
||||
var start = this.lineOffsetToPosition(fileName, entry.start);
|
||||
var end = this.lineOffsetToPosition(fileName, entry.end);
|
||||
|
||||
return {
|
||||
name: entry.name,
|
||||
@@ -237,14 +237,14 @@ module ts.server {
|
||||
}
|
||||
|
||||
getFormattingEditsForRange(fileName: string, start: number, end: number, options: ts.FormatCodeOptions): ts.TextChange[] {
|
||||
var startLineCol = this.positionToOneBasedLineCol(fileName, start);
|
||||
var endLineCol = this.positionToOneBasedLineCol(fileName, end);
|
||||
var startLineOffset = this.positionToOneBasedLineOffset(fileName, start);
|
||||
var endLineOffset = this.positionToOneBasedLineOffset(fileName, end);
|
||||
var args: protocol.FormatRequestArgs = {
|
||||
file: fileName,
|
||||
line: startLineCol.line,
|
||||
col: startLineCol.col,
|
||||
endLine: endLineCol.line,
|
||||
endCol: endLineCol.col,
|
||||
line: startLineOffset.line,
|
||||
offset: startLineOffset.offset,
|
||||
endLine: endLineOffset.line,
|
||||
endOffset: endLineOffset.offset,
|
||||
};
|
||||
|
||||
// TODO: handle FormatCodeOptions
|
||||
@@ -259,11 +259,11 @@ module ts.server {
|
||||
}
|
||||
|
||||
getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): ts.TextChange[] {
|
||||
var lineCol = this.positionToOneBasedLineCol(fileName, position);
|
||||
var lineOffset = this.positionToOneBasedLineOffset(fileName, position);
|
||||
var args: protocol.FormatOnKeyRequestArgs = {
|
||||
file: fileName,
|
||||
line: lineCol.line,
|
||||
col: lineCol.col,
|
||||
line: lineOffset.line,
|
||||
offset: lineOffset.offset,
|
||||
key: key
|
||||
};
|
||||
|
||||
@@ -275,11 +275,11 @@ module ts.server {
|
||||
}
|
||||
|
||||
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] {
|
||||
var lineCol = this.positionToOneBasedLineCol(fileName, position);
|
||||
var lineOffset = this.positionToOneBasedLineOffset(fileName, position);
|
||||
var args: protocol.FileLocationRequestArgs = {
|
||||
file: fileName,
|
||||
line: lineCol.line,
|
||||
col: lineCol.col,
|
||||
line: lineOffset.line,
|
||||
offset: lineOffset.offset,
|
||||
};
|
||||
|
||||
var request = this.processRequest<protocol.DefinitionRequest>(CommandNames.Definition, args);
|
||||
@@ -287,8 +287,8 @@ module ts.server {
|
||||
|
||||
return response.body.map(entry => {
|
||||
var fileName = entry.file;
|
||||
var start = this.lineColToPosition(fileName, entry.start);
|
||||
var end = this.lineColToPosition(fileName, entry.end);
|
||||
var start = this.lineOffsetToPosition(fileName, entry.start);
|
||||
var end = this.lineOffsetToPosition(fileName, entry.end);
|
||||
return {
|
||||
containerKind: "",
|
||||
containerName: "",
|
||||
@@ -301,11 +301,11 @@ module ts.server {
|
||||
}
|
||||
|
||||
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[] {
|
||||
var lineCol = this.positionToOneBasedLineCol(fileName, position);
|
||||
var lineOffset = this.positionToOneBasedLineOffset(fileName, position);
|
||||
var args: protocol.FileLocationRequestArgs = {
|
||||
file: fileName,
|
||||
line: lineCol.line,
|
||||
col: lineCol.col,
|
||||
line: lineOffset.line,
|
||||
offset: lineOffset.offset,
|
||||
};
|
||||
|
||||
var request = this.processRequest<protocol.ReferencesRequest>(CommandNames.References, args);
|
||||
@@ -313,8 +313,8 @@ module ts.server {
|
||||
|
||||
return response.body.refs.map(entry => {
|
||||
var fileName = entry.file;
|
||||
var start = this.lineColToPosition(fileName, entry.start);
|
||||
var end = this.lineColToPosition(fileName, entry.end);
|
||||
var start = this.lineOffsetToPosition(fileName, entry.start);
|
||||
var end = this.lineOffsetToPosition(fileName, entry.end);
|
||||
return {
|
||||
fileName: fileName,
|
||||
textSpan: ts.createTextSpanFromBounds(start, end),
|
||||
@@ -340,11 +340,11 @@ module ts.server {
|
||||
}
|
||||
|
||||
getRenameInfo(fileName: string, position: number, findInStrings?: boolean, findInComments?: boolean): RenameInfo {
|
||||
var lineCol = this.positionToOneBasedLineCol(fileName, position);
|
||||
var lineOffset = this.positionToOneBasedLineOffset(fileName, position);
|
||||
var args: protocol.RenameRequestArgs = {
|
||||
file: fileName,
|
||||
line: lineCol.line,
|
||||
col: lineCol.col,
|
||||
line: lineOffset.line,
|
||||
offset: lineOffset.offset,
|
||||
findInStrings,
|
||||
findInComments
|
||||
};
|
||||
@@ -355,8 +355,8 @@ module ts.server {
|
||||
response.body.locs.map((entry: protocol.SpanGroup) => {
|
||||
var fileName = entry.file;
|
||||
entry.locs.map((loc: protocol.TextSpan) => {
|
||||
var start = this.lineColToPosition(fileName, loc.start);
|
||||
var end = this.lineColToPosition(fileName, loc.end);
|
||||
var start = this.lineOffsetToPosition(fileName, loc.start);
|
||||
var end = this.lineOffsetToPosition(fileName, loc.end);
|
||||
locations.push({
|
||||
textSpan: ts.createTextSpanFromBounds(start, end),
|
||||
fileName: fileName
|
||||
@@ -400,7 +400,7 @@ module ts.server {
|
||||
text: item.text,
|
||||
kind: item.kind,
|
||||
kindModifiers: item.kindModifiers || "",
|
||||
spans: item.spans.map(span=> createTextSpanFromBounds(this.lineColToPosition(fileName, span.start), this.lineColToPosition(fileName, span.end))),
|
||||
spans: item.spans.map(span=> createTextSpanFromBounds(this.lineOffsetToPosition(fileName, span.start), this.lineOffsetToPosition(fileName, span.end))),
|
||||
childItems: this.decodeNavigationBarItems(item.childItems, fileName),
|
||||
indent: 0,
|
||||
bolded: false,
|
||||
@@ -444,19 +444,19 @@ module ts.server {
|
||||
}
|
||||
|
||||
getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[] {
|
||||
var lineCol = this.positionToOneBasedLineCol(fileName, position);
|
||||
var lineOffset = this.positionToOneBasedLineOffset(fileName, position);
|
||||
var args: protocol.FileLocationRequestArgs = {
|
||||
file: fileName,
|
||||
line: lineCol.line,
|
||||
col: lineCol.col,
|
||||
line: lineOffset.line,
|
||||
offset: lineOffset.offset,
|
||||
};
|
||||
|
||||
var request = this.processRequest<protocol.BraceRequest>(CommandNames.Brace, args);
|
||||
var response = this.processResponse<protocol.BraceResponse>(request);
|
||||
|
||||
return response.body.map(entry => {
|
||||
var start = this.lineColToPosition(fileName, entry.start);
|
||||
var end = this.lineColToPosition(fileName, entry.end);
|
||||
var start = this.lineOffsetToPosition(fileName, entry.start);
|
||||
var end = this.lineOffsetToPosition(fileName, entry.end);
|
||||
return {
|
||||
start: start,
|
||||
length: end - start,
|
||||
|
||||
@@ -19,15 +19,23 @@ module ts.server {
|
||||
class ScriptInfo {
|
||||
svc: ScriptVersionCache;
|
||||
children: ScriptInfo[] = []; // files referenced by this file
|
||||
|
||||
defaultProject: Project; // project to use by default for file
|
||||
|
||||
fileWatcher: FileWatcher;
|
||||
formatCodeOptions = ts.clone(CompilerService.defaultFormatCodeOptions);
|
||||
|
||||
constructor(private host: ServerHost, public fileName: string, public content: string, public isOpen = false) {
|
||||
this.svc = ScriptVersionCache.fromString(content);
|
||||
}
|
||||
|
||||
setFormatOptions(tabSize?: number, indentSize?: number) {
|
||||
if (tabSize) {
|
||||
this.formatCodeOptions.TabSize = tabSize;
|
||||
}
|
||||
if (indentSize) {
|
||||
this.formatCodeOptions.IndentSize = indentSize;
|
||||
}
|
||||
}
|
||||
|
||||
close() {
|
||||
this.isOpen = false;
|
||||
}
|
||||
@@ -200,33 +208,33 @@ module ts.server {
|
||||
}
|
||||
else {
|
||||
var nextLineInfo = index.lineNumberToInfo(line + 2);
|
||||
len = nextLineInfo.col - lineInfo.col;
|
||||
len = nextLineInfo.offset - lineInfo.offset;
|
||||
}
|
||||
return ts.createTextSpan(lineInfo.col, len);
|
||||
return ts.createTextSpan(lineInfo.offset, len);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param line 1 based index
|
||||
* @param col 1 based index
|
||||
* @param offset 1 based index
|
||||
*/
|
||||
lineColToPosition(filename: string, line: number, col: number): number {
|
||||
lineOffsetToPosition(filename: string, line: number, offset: number): number {
|
||||
var script: ScriptInfo = this.filenameToScript[filename];
|
||||
var index = script.snap().index;
|
||||
|
||||
var lineInfo = index.lineNumberToInfo(line);
|
||||
// TODO: assert this column is actually on the line
|
||||
return (lineInfo.col + col - 1);
|
||||
// TODO: assert this offset is actually on the line
|
||||
return (lineInfo.offset + offset - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param line 1-based index
|
||||
* @param col 1-based index
|
||||
* @param offset 1-based index
|
||||
*/
|
||||
positionToLineCol(filename: string, position: number): ILineInfo {
|
||||
positionToLineOffset(filename: string, position: number): ILineInfo {
|
||||
var script: ScriptInfo = this.filenameToScript[filename];
|
||||
var index = script.snap().index;
|
||||
var lineCol = index.charOffsetToLineNumberAndPos(position);
|
||||
return { line: lineCol.line, col: lineCol.col + 1 };
|
||||
var lineOffset = index.charOffsetToLineNumberAndPos(position);
|
||||
return { line: lineOffset.line, offset: lineOffset.offset + 1 };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,7 +267,6 @@ module ts.server {
|
||||
interface ProjectOptions {
|
||||
// these fields can be present in the project file
|
||||
files?: string[];
|
||||
formatCodeOptions?: ts.FormatCodeOptions;
|
||||
compilerOptions?: ts.CompilerOptions;
|
||||
}
|
||||
|
||||
@@ -338,7 +345,6 @@ module ts.server {
|
||||
if (projectOptions.compilerOptions) {
|
||||
this.compilerService.setCompilerOptions(projectOptions.compilerOptions);
|
||||
}
|
||||
// TODO: format code options
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,6 +368,11 @@ module ts.server {
|
||||
(eventName: string, project: Project, fileName: string): void;
|
||||
}
|
||||
|
||||
interface HostConfiguration {
|
||||
formatCodeOptions: ts.FormatCodeOptions;
|
||||
hostInfo: string;
|
||||
}
|
||||
|
||||
export class ProjectService {
|
||||
filenameToScriptInfo: ts.Map<ScriptInfo> = {};
|
||||
// open, non-configured files in two lists
|
||||
@@ -369,9 +380,28 @@ module ts.server {
|
||||
openFilesReferenced: ScriptInfo[] = [];
|
||||
// projects covering open files
|
||||
inferredProjects: Project[] = [];
|
||||
hostConfiguration: HostConfiguration;
|
||||
|
||||
constructor(public host: ServerHost, public psLogger: Logger, public eventHandler?: ProjectServiceEventHandler) {
|
||||
// ts.disableIncrementalParsing = true;
|
||||
this.addDefaultHostConfiguration();
|
||||
}
|
||||
|
||||
addDefaultHostConfiguration() {
|
||||
this.hostConfiguration = {
|
||||
formatCodeOptions: ts.clone(CompilerService.defaultFormatCodeOptions),
|
||||
hostInfo: "Unknown host"
|
||||
}
|
||||
}
|
||||
|
||||
getFormatCodeOptions(file?: string) {
|
||||
if (file) {
|
||||
var info = this.filenameToScriptInfo[file];
|
||||
if (info) {
|
||||
return info.formatCodeOptions;
|
||||
}
|
||||
}
|
||||
return this.hostConfiguration.formatCodeOptions;
|
||||
}
|
||||
|
||||
watchedFileChanged(fileName: string) {
|
||||
@@ -395,6 +425,22 @@ module ts.server {
|
||||
this.psLogger.msg(msg, type);
|
||||
}
|
||||
|
||||
setHostConfiguration(args: ts.server.protocol.ConfigureRequestArguments) {
|
||||
if (args.file) {
|
||||
var info = this.filenameToScriptInfo[args.file];
|
||||
if (info) {
|
||||
info.setFormatOptions(args.tabSize, args.indentSize);
|
||||
this.log("Host configuration update for file " + args.file + " tab size " + args.tabSize);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.hostConfiguration.formatCodeOptions.TabSize = args.tabSize;
|
||||
this.hostConfiguration.formatCodeOptions.IndentSize = args.indentSize;
|
||||
this.hostConfiguration.hostInfo = args.hostInfo;
|
||||
this.log("Host information " + args.hostInfo, "Info");
|
||||
}
|
||||
}
|
||||
|
||||
closeLog() {
|
||||
this.psLogger.close();
|
||||
}
|
||||
@@ -595,7 +641,7 @@ module ts.server {
|
||||
/**
|
||||
* @param filename is absolute pathname
|
||||
*/
|
||||
openFile(fileName: string, openedByClient = false) {
|
||||
openFile(fileName: string, openedByClient: boolean) {
|
||||
fileName = ts.normalizePath(fileName);
|
||||
var info = ts.lookUp(this.filenameToScriptInfo, fileName);
|
||||
if (!info) {
|
||||
@@ -609,6 +655,7 @@ module ts.server {
|
||||
}
|
||||
}
|
||||
if (content !== undefined) {
|
||||
var indentSize: number;
|
||||
info = new ScriptInfo(this.host, fileName, content, openedByClient);
|
||||
this.filenameToScriptInfo[fileName] = info;
|
||||
if (!info.isOpen) {
|
||||
@@ -731,7 +778,8 @@ module ts.server {
|
||||
var normRootFilename = ts.normalizePath(rootFilename);
|
||||
normRootFilename = getAbsolutePath(normRootFilename, dirPath);
|
||||
if (this.host.fileExists(normRootFilename)) {
|
||||
var info = this.openFile(normRootFilename);
|
||||
// TODO: pass true for file exiplicitly opened
|
||||
var info = this.openFile(normRootFilename, false);
|
||||
proj.addRoot(info);
|
||||
}
|
||||
else {
|
||||
@@ -742,9 +790,6 @@ module ts.server {
|
||||
files: parsedCommandLine.fileNames,
|
||||
compilerOptions: parsedCommandLine.options
|
||||
};
|
||||
if (rawConfig.formatCodeOptions) {
|
||||
projectOptions.formatCodeOptions = rawConfig.formatCodeOptions;
|
||||
}
|
||||
proj.setProjectOptions(projectOptions);
|
||||
return { success: true, project: proj };
|
||||
}
|
||||
@@ -768,7 +813,6 @@ module ts.server {
|
||||
classifier: ts.Classifier;
|
||||
settings = ts.getDefaultCompilerOptions();
|
||||
documentRegistry = ts.createDocumentRegistry();
|
||||
formatCodeOptions: ts.FormatCodeOptions = CompilerService.defaultFormatCodeOptions;
|
||||
|
||||
constructor(public project: Project) {
|
||||
this.host = new LSHost(project.projectService.host, project);
|
||||
@@ -815,7 +859,7 @@ module ts.server {
|
||||
|
||||
export interface ILineInfo {
|
||||
line: number;
|
||||
col: number;
|
||||
offset: number;
|
||||
text?: string;
|
||||
leaf?: LineLeaf;
|
||||
}
|
||||
@@ -1208,7 +1252,7 @@ module ts.server {
|
||||
|
||||
getLineMapper() {
|
||||
return ((line: number) => {
|
||||
return this.index.lineNumberToInfo(line).col;
|
||||
return this.index.lineNumberToInfo(line).offset;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1245,7 +1289,7 @@ module ts.server {
|
||||
else {
|
||||
return {
|
||||
line: lineNumber,
|
||||
col: this.root.charCount()
|
||||
offset: this.root.charCount()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1331,7 +1375,7 @@ module ts.server {
|
||||
// check whether last characters deleted are line break
|
||||
var e = pos + deleteLength;
|
||||
var lineInfo = this.charOffsetToLineNumberAndPos(e);
|
||||
if ((lineInfo && (lineInfo.col == 0))) {
|
||||
if ((lineInfo && (lineInfo.offset == 0))) {
|
||||
// move range end just past line that will merge with previous line
|
||||
deleteLength += lineInfo.text.length;
|
||||
// store text by appending to end of insertedText
|
||||
@@ -1507,14 +1551,14 @@ module ts.server {
|
||||
if (!childInfo.child) {
|
||||
return {
|
||||
line: lineNumber,
|
||||
col: charOffset,
|
||||
offset: charOffset,
|
||||
}
|
||||
}
|
||||
else if (childInfo.childIndex < this.children.length) {
|
||||
if (childInfo.child.isLeaf()) {
|
||||
return {
|
||||
line: childInfo.lineNumber,
|
||||
col: childInfo.charOffset,
|
||||
offset: childInfo.charOffset,
|
||||
text: (<LineLeaf>(childInfo.child)).text,
|
||||
leaf: (<LineLeaf>(childInfo.child))
|
||||
};
|
||||
@@ -1526,7 +1570,7 @@ module ts.server {
|
||||
}
|
||||
else {
|
||||
var lineInfo = this.lineNumberToInfo(this.lineCount(), 0);
|
||||
return { line: this.lineCount(), col: lineInfo.leaf.charCount() };
|
||||
return { line: this.lineCount(), offset: lineInfo.leaf.charCount() };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1535,13 +1579,13 @@ module ts.server {
|
||||
if (!childInfo.child) {
|
||||
return {
|
||||
line: lineNumber,
|
||||
col: charOffset
|
||||
offset: charOffset
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (childInfo.child.isLeaf()) {
|
||||
return {
|
||||
line: lineNumber,
|
||||
col: childInfo.charOffset,
|
||||
offset: childInfo.charOffset,
|
||||
text: (<LineLeaf>(childInfo.child)).text,
|
||||
leaf: (<LineLeaf>(childInfo.child))
|
||||
}
|
||||
|
||||
Vendored
+57
-12
@@ -96,7 +96,7 @@ declare module ts.server.protocol {
|
||||
|
||||
/**
|
||||
* Instances of this interface specify a location in a source file:
|
||||
* (file, line, col), where line and column are 1-based.
|
||||
* (file, line, character offset), where line and character offset are 1-based.
|
||||
*/
|
||||
export interface FileLocationRequestArgs extends FileRequestArgs {
|
||||
/**
|
||||
@@ -105,9 +105,9 @@ declare module ts.server.protocol {
|
||||
line: number;
|
||||
|
||||
/**
|
||||
* The column for the request (1-based).
|
||||
* The character offset (on the line) for the request (1-based).
|
||||
*/
|
||||
col: number;
|
||||
offset: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,11 +126,11 @@ declare module ts.server.protocol {
|
||||
}
|
||||
|
||||
/**
|
||||
* Location in source code expressed as (one-based) line and column.
|
||||
* Location in source code expressed as (one-based) line and character offset.
|
||||
*/
|
||||
export interface Location {
|
||||
line: number;
|
||||
col: number;
|
||||
offset: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -202,9 +202,9 @@ declare module ts.server.protocol {
|
||||
symbolName: string;
|
||||
|
||||
/**
|
||||
* The start column of the symbol (on the line provided by the references request).
|
||||
* The start character offset of the symbol (on the line provided by the references request).
|
||||
*/
|
||||
symbolStartCol: number;
|
||||
symbolStartOffset: number;
|
||||
|
||||
/**
|
||||
* The full display name of the symbol.
|
||||
@@ -299,6 +299,50 @@ declare module ts.server.protocol {
|
||||
body?: RenameResponseBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* Information found in a configure request.
|
||||
*/
|
||||
export interface ConfigureRequestArguments {
|
||||
/** Number of spaces for each tab */
|
||||
tabSize: number;
|
||||
/** Number of spaces to indent during formatting */
|
||||
indentSize: number;
|
||||
/**
|
||||
* Information about the host, for example 'Emacs 24.4' or
|
||||
* 'Sublime Text version 3075'
|
||||
*/
|
||||
hostInfo: string;
|
||||
/**
|
||||
* If present, tab settings apply only to this file.
|
||||
*/
|
||||
file?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure request; value of command field is "configure". Specifies
|
||||
* host information, such as host type, tab size, and indent size.
|
||||
*/
|
||||
export interface ConfigureRequest extends Request {
|
||||
arguments: ConfigureRequestArguments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Response to "configure" request. This is just an acknowledgement, so
|
||||
* no body field is required.
|
||||
*/
|
||||
export interface ConfigureResponse extends Response {
|
||||
}
|
||||
|
||||
/**
|
||||
* Information found in an "open" request.
|
||||
*/
|
||||
export interface OpenRequestArgs extends FileRequestArgs {
|
||||
/** Initial tab size of file. */
|
||||
tabSize?: number;
|
||||
/** Number of spaces to indent during formatting */
|
||||
indentSize?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open request; value of command field is "open". Notify the
|
||||
* server that the client has file open. The server will not
|
||||
@@ -307,7 +351,8 @@ declare module ts.server.protocol {
|
||||
* reload messages) when the file changes. Server does not currently
|
||||
* send a response to an open request.
|
||||
*/
|
||||
export interface OpenRequest extends FileRequest {
|
||||
export interface OpenRequest extends Request {
|
||||
arguments: OpenRequestArgs;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -381,9 +426,9 @@ declare module ts.server.protocol {
|
||||
endLine: number;
|
||||
|
||||
/**
|
||||
* Last column of range for which to format text in file.
|
||||
* Character offset on last line of range for which to format text in file.
|
||||
*/
|
||||
endCol: number;
|
||||
endOffset: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -762,7 +807,7 @@ declare module ts.server.protocol {
|
||||
*/
|
||||
export interface ChangeRequestArgs extends FormatRequestArgs {
|
||||
/**
|
||||
* Optional string to insert at location (file, line, col).
|
||||
* Optional string to insert at location (file, line, offset).
|
||||
*/
|
||||
insertString?: string;
|
||||
}
|
||||
@@ -786,7 +831,7 @@ declare module ts.server.protocol {
|
||||
/**
|
||||
* Brace matching request; value of command field is "brace".
|
||||
* Return response giving the file locations of matching braces
|
||||
* found in file at location line, col.
|
||||
* found in file at location line, offset.
|
||||
*/
|
||||
export interface BraceRequest extends FileLocationRequest {
|
||||
}
|
||||
|
||||
+83
-68
@@ -5,13 +5,13 @@
|
||||
/// <reference path="editorServices.ts" />
|
||||
|
||||
module ts.server {
|
||||
var spaceCache = [" ", " ", " ", " "];
|
||||
var spaceCache:string[] = [];
|
||||
|
||||
interface StackTraceError extends Error {
|
||||
stack?: string;
|
||||
}
|
||||
|
||||
function generateSpaces(n: number): string {
|
||||
export function generateSpaces(n: number): string {
|
||||
if (!spaceCache[n]) {
|
||||
var strBuilder = "";
|
||||
for (var i = 0; i < n; i++) {
|
||||
@@ -44,7 +44,7 @@ module ts.server {
|
||||
else if (a.file == b.file) {
|
||||
var n = compareNumber(a.start.line, b.start.line);
|
||||
if (n == 0) {
|
||||
return compareNumber(a.start.col, b.start.col);
|
||||
return compareNumber(a.start.offset, b.start.offset);
|
||||
}
|
||||
else return n;
|
||||
}
|
||||
@@ -55,8 +55,8 @@ module ts.server {
|
||||
|
||||
function formatDiag(fileName: string, project: Project, diag: ts.Diagnostic) {
|
||||
return {
|
||||
start: project.compilerService.host.positionToLineCol(fileName, diag.start),
|
||||
end: project.compilerService.host.positionToLineCol(fileName, diag.start + diag.length),
|
||||
start: project.compilerService.host.positionToLineOffset(fileName, diag.start),
|
||||
end: project.compilerService.host.positionToLineOffset(fileName, diag.start + diag.length),
|
||||
text: ts.flattenDiagnosticMessageText(diag.messageText, "\n")
|
||||
};
|
||||
}
|
||||
@@ -80,6 +80,7 @@ module ts.server {
|
||||
export var Close = "close";
|
||||
export var Completions = "completions";
|
||||
export var CompletionDetails = "completionEntryDetails";
|
||||
export var Configure = "configure";
|
||||
export var Definition = "definition";
|
||||
export var Format = "format";
|
||||
export var Formatonkey = "formatonkey";
|
||||
@@ -259,7 +260,7 @@ module ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
getDefinition(line: number, col: number, fileName: string): protocol.FileSpan[] {
|
||||
getDefinition(line: number, offset: number, fileName: string): protocol.FileSpan[] {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (!project) {
|
||||
@@ -267,7 +268,7 @@ module ts.server {
|
||||
}
|
||||
|
||||
var compilerService = project.compilerService;
|
||||
var position = compilerService.host.lineColToPosition(file, line, col);
|
||||
var position = compilerService.host.lineOffsetToPosition(file, line, offset);
|
||||
|
||||
var definitions = compilerService.languageService.getDefinitionAtPosition(file, position);
|
||||
if (!definitions) {
|
||||
@@ -276,12 +277,12 @@ module ts.server {
|
||||
|
||||
return definitions.map(def => ({
|
||||
file: def.fileName,
|
||||
start: compilerService.host.positionToLineCol(def.fileName, def.textSpan.start),
|
||||
end: compilerService.host.positionToLineCol(def.fileName, ts.textSpanEnd(def.textSpan))
|
||||
start: compilerService.host.positionToLineOffset(def.fileName, def.textSpan.start),
|
||||
end: compilerService.host.positionToLineOffset(def.fileName, ts.textSpanEnd(def.textSpan))
|
||||
}));
|
||||
}
|
||||
|
||||
getRenameLocations(line: number, col: number, fileName: string,findInComments: boolean, findInStrings: boolean): protocol.RenameResponseBody {
|
||||
getRenameLocations(line: number, offset: number, fileName: string,findInComments: boolean, findInStrings: boolean): protocol.RenameResponseBody {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (!project) {
|
||||
@@ -289,7 +290,7 @@ module ts.server {
|
||||
}
|
||||
|
||||
var compilerService = project.compilerService;
|
||||
var position = compilerService.host.lineColToPosition(file, line, col);
|
||||
var position = compilerService.host.lineOffsetToPosition(file, line, offset);
|
||||
var renameInfo = compilerService.languageService.getRenameInfo(file, position);
|
||||
if (!renameInfo) {
|
||||
return undefined;
|
||||
@@ -309,8 +310,8 @@ module ts.server {
|
||||
|
||||
var bakedRenameLocs = renameLocations.map(location => (<protocol.FileSpan>{
|
||||
file: location.fileName,
|
||||
start: compilerService.host.positionToLineCol(location.fileName, location.textSpan.start),
|
||||
end: compilerService.host.positionToLineCol(location.fileName, ts.textSpanEnd(location.textSpan)),
|
||||
start: compilerService.host.positionToLineOffset(location.fileName, location.textSpan.start),
|
||||
end: compilerService.host.positionToLineOffset(location.fileName, ts.textSpanEnd(location.textSpan)),
|
||||
})).sort((a, b) => {
|
||||
if (a.file < b.file) {
|
||||
return -1;
|
||||
@@ -327,7 +328,7 @@ module ts.server {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
return b.start.col - a.start.col;
|
||||
return b.start.offset - a.start.offset;
|
||||
}
|
||||
}
|
||||
}).reduce<protocol.SpanGroup[]>((accum: protocol.SpanGroup[], cur: protocol.FileSpan) => {
|
||||
@@ -349,7 +350,7 @@ module ts.server {
|
||||
return { info: renameInfo, locs: bakedRenameLocs };
|
||||
}
|
||||
|
||||
getReferences(line: number, col: number, fileName: string): protocol.ReferencesResponseBody {
|
||||
getReferences(line: number, offset: number, fileName: string): protocol.ReferencesResponseBody {
|
||||
// TODO: get all projects for this file; report refs for all projects deleting duplicates
|
||||
// can avoid duplicates by eliminating same ref file from subsequent projects
|
||||
var file = ts.normalizePath(fileName);
|
||||
@@ -359,7 +360,7 @@ module ts.server {
|
||||
}
|
||||
|
||||
var compilerService = project.compilerService;
|
||||
var position = compilerService.host.lineColToPosition(file, line, col);
|
||||
var position = compilerService.host.lineOffsetToPosition(file, line, offset);
|
||||
|
||||
var references = compilerService.languageService.getReferencesAtPosition(file, position);
|
||||
if (!references) {
|
||||
@@ -373,10 +374,10 @@ module ts.server {
|
||||
|
||||
var displayString = ts.displayPartsToString(nameInfo.displayParts);
|
||||
var nameSpan = nameInfo.textSpan;
|
||||
var nameColStart = compilerService.host.positionToLineCol(file, nameSpan.start).col;
|
||||
var nameColStart = compilerService.host.positionToLineOffset(file, nameSpan.start).offset;
|
||||
var nameText = compilerService.host.getScriptSnapshot(file).getText(nameSpan.start, ts.textSpanEnd(nameSpan));
|
||||
var bakedRefs: protocol.ReferencesResponseItem[] = references.map((ref) => {
|
||||
var start = compilerService.host.positionToLineCol(ref.fileName, ref.textSpan.start);
|
||||
var start = compilerService.host.positionToLineOffset(ref.fileName, ref.textSpan.start);
|
||||
var refLineSpan = compilerService.host.lineToTextSpan(ref.fileName, start.line - 1);
|
||||
var snap = compilerService.host.getScriptSnapshot(ref.fileName);
|
||||
var lineText = snap.getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, "");
|
||||
@@ -384,24 +385,27 @@ module ts.server {
|
||||
file: ref.fileName,
|
||||
start: start,
|
||||
lineText: lineText,
|
||||
end: compilerService.host.positionToLineCol(ref.fileName, ts.textSpanEnd(ref.textSpan)),
|
||||
end: compilerService.host.positionToLineOffset(ref.fileName, ts.textSpanEnd(ref.textSpan)),
|
||||
isWriteAccess: ref.isWriteAccess
|
||||
};
|
||||
}).sort(compareFileStart);
|
||||
return {
|
||||
refs: bakedRefs,
|
||||
symbolName: nameText,
|
||||
symbolStartCol: nameColStart,
|
||||
symbolStartOffset: nameColStart,
|
||||
symbolDisplayString: displayString
|
||||
};
|
||||
}
|
||||
|
||||
openClientFile(fileName: string) {
|
||||
openClientFile(fileName: string, tabSize?: number, indentSize?: number) {
|
||||
var file = ts.normalizePath(fileName);
|
||||
this.projectService.openClientFile(file);
|
||||
var info = this.projectService.openClientFile(file);
|
||||
if (info) {
|
||||
info.setFormatOptions(tabSize, indentSize);
|
||||
}
|
||||
}
|
||||
|
||||
getQuickInfo(line: number, col: number, fileName: string): protocol.QuickInfoResponseBody {
|
||||
getQuickInfo(line: number, offset: number, fileName: string): protocol.QuickInfoResponseBody {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (!project) {
|
||||
@@ -409,7 +413,7 @@ module ts.server {
|
||||
}
|
||||
|
||||
var compilerService = project.compilerService;
|
||||
var position = compilerService.host.lineColToPosition(file, line, col);
|
||||
var position = compilerService.host.lineOffsetToPosition(file, line, offset);
|
||||
var quickInfo = compilerService.languageService.getQuickInfoAtPosition(file, position);
|
||||
if (!quickInfo) {
|
||||
return undefined;
|
||||
@@ -420,14 +424,14 @@ module ts.server {
|
||||
return {
|
||||
kind: quickInfo.kind,
|
||||
kindModifiers: quickInfo.kindModifiers,
|
||||
start: compilerService.host.positionToLineCol(file, quickInfo.textSpan.start),
|
||||
end: compilerService.host.positionToLineCol(file, ts.textSpanEnd(quickInfo.textSpan)),
|
||||
start: compilerService.host.positionToLineOffset(file, quickInfo.textSpan.start),
|
||||
end: compilerService.host.positionToLineOffset(file, ts.textSpanEnd(quickInfo.textSpan)),
|
||||
displayString: displayString,
|
||||
documentation: docString,
|
||||
};
|
||||
}
|
||||
|
||||
getFormattingEditsForRange(line: number, col: number, endLine: number, endCol: number, fileName: string): protocol.CodeEdit[] {
|
||||
getFormattingEditsForRange(line: number, offset: number, endLine: number, endOffset: number, fileName: string): protocol.CodeEdit[] {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (!project) {
|
||||
@@ -435,25 +439,26 @@ module ts.server {
|
||||
}
|
||||
|
||||
var compilerService = project.compilerService;
|
||||
var startPosition = compilerService.host.lineColToPosition(file, line, col);
|
||||
var endPosition = compilerService.host.lineColToPosition(file, endLine, endCol);
|
||||
var startPosition = compilerService.host.lineOffsetToPosition(file, line, offset);
|
||||
var endPosition = compilerService.host.lineOffsetToPosition(file, endLine, endOffset);
|
||||
|
||||
// TODO: avoid duplicate code (with formatonkey)
|
||||
var edits = compilerService.languageService.getFormattingEditsForRange(file, startPosition, endPosition, compilerService.formatCodeOptions);
|
||||
var edits = compilerService.languageService.getFormattingEditsForRange(file, startPosition, endPosition,
|
||||
this.projectService.getFormatCodeOptions(file));
|
||||
if (!edits) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return edits.map((edit) => {
|
||||
return {
|
||||
start: compilerService.host.positionToLineCol(file, edit.span.start),
|
||||
end: compilerService.host.positionToLineCol(file, ts.textSpanEnd(edit.span)),
|
||||
start: compilerService.host.positionToLineOffset(file, edit.span.start),
|
||||
end: compilerService.host.positionToLineOffset(file, ts.textSpanEnd(edit.span)),
|
||||
newText: edit.newText ? edit.newText : ""
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
getFormattingEditsAfterKeystroke(line: number, col: number, key: string, fileName: string): protocol.CodeEdit[] {
|
||||
getFormattingEditsAfterKeystroke(line: number, offset: number, key: string, fileName: string): protocol.CodeEdit[] {
|
||||
var file = ts.normalizePath(fileName);
|
||||
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
@@ -462,9 +467,10 @@ module ts.server {
|
||||
}
|
||||
|
||||
var compilerService = project.compilerService;
|
||||
var position = compilerService.host.lineColToPosition(file, line, col);
|
||||
var position = compilerService.host.lineOffsetToPosition(file, line, offset);
|
||||
var formatOptions = this.projectService.getFormatCodeOptions(file);
|
||||
var edits = compilerService.languageService.getFormattingEditsAfterKeystroke(file, position, key,
|
||||
compilerService.formatCodeOptions);
|
||||
formatOptions);
|
||||
// Check whether we should auto-indent. This will be when
|
||||
// the position is on a line containing only whitespace.
|
||||
// This should leave the edits returned from
|
||||
@@ -480,8 +486,8 @@ module ts.server {
|
||||
if (lineText.search("\\S") < 0) {
|
||||
// TODO: get these options from host
|
||||
var editorOptions: ts.EditorOptions = {
|
||||
IndentSize: 4,
|
||||
TabSize: 4,
|
||||
IndentSize: formatOptions.IndentSize,
|
||||
TabSize: formatOptions.TabSize,
|
||||
NewLineCharacter: "\n",
|
||||
ConvertTabsToSpaces: true,
|
||||
};
|
||||
@@ -516,16 +522,16 @@ module ts.server {
|
||||
|
||||
return edits.map((edit) => {
|
||||
return {
|
||||
start: compilerService.host.positionToLineCol(file,
|
||||
start: compilerService.host.positionToLineOffset(file,
|
||||
edit.span.start),
|
||||
end: compilerService.host.positionToLineCol(file,
|
||||
end: compilerService.host.positionToLineOffset(file,
|
||||
ts.textSpanEnd(edit.span)),
|
||||
newText: edit.newText ? edit.newText : ""
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
getCompletions(line: number, col: number, prefix: string, fileName: string): protocol.CompletionEntry[] {
|
||||
getCompletions(line: number, offset: number, prefix: string, fileName: string): protocol.CompletionEntry[] {
|
||||
if (!prefix) {
|
||||
prefix = "";
|
||||
}
|
||||
@@ -536,7 +542,7 @@ module ts.server {
|
||||
}
|
||||
|
||||
var compilerService = project.compilerService;
|
||||
var position = compilerService.host.lineColToPosition(file, line, col);
|
||||
var position = compilerService.host.lineOffsetToPosition(file, line, offset);
|
||||
|
||||
var completions = compilerService.languageService.getCompletionsAtPosition(file, position);
|
||||
if (!completions) {
|
||||
@@ -551,7 +557,7 @@ module ts.server {
|
||||
}, []);
|
||||
}
|
||||
|
||||
getCompletionEntryDetails(line: number, col: number,
|
||||
getCompletionEntryDetails(line: number, offset: number,
|
||||
entryNames: string[], fileName: string): protocol.CompletionEntryDetails[] {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
@@ -560,7 +566,7 @@ module ts.server {
|
||||
}
|
||||
|
||||
var compilerService = project.compilerService;
|
||||
var position = compilerService.host.lineColToPosition(file, line, col);
|
||||
var position = compilerService.host.lineOffsetToPosition(file, line, offset);
|
||||
|
||||
return entryNames.reduce((accum: protocol.CompletionEntryDetails[], entryName: string) => {
|
||||
var details = compilerService.languageService.getCompletionEntryDetails(file, position, entryName);
|
||||
@@ -586,13 +592,13 @@ module ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
change(line: number, col: number, endLine: number, endCol: number, insertString: string, fileName: string) {
|
||||
change(line: number, offset: number, endLine: number, endOffset: number, insertString: string, fileName: string) {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (project) {
|
||||
var compilerService = project.compilerService;
|
||||
var start = compilerService.host.lineColToPosition(file, line, col);
|
||||
var end = compilerService.host.lineColToPosition(file, endLine, endCol);
|
||||
var start = compilerService.host.lineOffsetToPosition(file, line, offset);
|
||||
var end = compilerService.host.lineOffsetToPosition(file, endLine, endOffset);
|
||||
if (start >= 0) {
|
||||
compilerService.host.editScript(file, start, end, insertString);
|
||||
this.changeSeq++;
|
||||
@@ -608,7 +614,7 @@ module ts.server {
|
||||
if (project) {
|
||||
this.changeSeq++;
|
||||
// make sure no changes happen before this one is finished
|
||||
project.compilerService.host.reloadScript(file, tmpfile,() => {
|
||||
project.compilerService.host.reloadScript(file, tmpfile, () => {
|
||||
this.output(undefined, CommandNames.Reload, reqSeq);
|
||||
});
|
||||
}
|
||||
@@ -641,8 +647,8 @@ module ts.server {
|
||||
kind: item.kind,
|
||||
kindModifiers: item.kindModifiers,
|
||||
spans: item.spans.map(span => ({
|
||||
start: compilerService.host.positionToLineCol(fileName, span.start),
|
||||
end: compilerService.host.positionToLineCol(fileName, ts.textSpanEnd(span))
|
||||
start: compilerService.host.positionToLineOffset(fileName, span.start),
|
||||
end: compilerService.host.positionToLineOffset(fileName, ts.textSpanEnd(span))
|
||||
})),
|
||||
childItems: this.decorateNavigationBarItem(project, fileName, item.childItems)
|
||||
}));
|
||||
@@ -678,8 +684,8 @@ module ts.server {
|
||||
}
|
||||
|
||||
return navItems.map((navItem) => {
|
||||
var start = compilerService.host.positionToLineCol(navItem.fileName, navItem.textSpan.start);
|
||||
var end = compilerService.host.positionToLineCol(navItem.fileName, ts.textSpanEnd(navItem.textSpan));
|
||||
var start = compilerService.host.positionToLineOffset(navItem.fileName, navItem.textSpan.start);
|
||||
var end = compilerService.host.positionToLineOffset(navItem.fileName, ts.textSpanEnd(navItem.textSpan));
|
||||
var bakedItem: protocol.NavtoItem = {
|
||||
name: navItem.name,
|
||||
kind: navItem.kind,
|
||||
@@ -703,7 +709,7 @@ module ts.server {
|
||||
});
|
||||
}
|
||||
|
||||
getBraceMatching(line: number, col: number, fileName: string): protocol.TextSpan[] {
|
||||
getBraceMatching(line: number, offset: number, fileName: string): protocol.TextSpan[] {
|
||||
var file = ts.normalizePath(fileName);
|
||||
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
@@ -712,7 +718,7 @@ module ts.server {
|
||||
}
|
||||
|
||||
var compilerService = project.compilerService;
|
||||
var position = compilerService.host.lineColToPosition(file, line, col);
|
||||
var position = compilerService.host.lineOffsetToPosition(file, line, offset);
|
||||
|
||||
var spans = compilerService.languageService.getBraceMatchingAtPosition(file, position);
|
||||
if (!spans) {
|
||||
@@ -720,8 +726,8 @@ module ts.server {
|
||||
}
|
||||
|
||||
return spans.map(span => ({
|
||||
start: compilerService.host.positionToLineCol(file, span.start),
|
||||
end: compilerService.host.positionToLineCol(file, span.start + span.length)
|
||||
start: compilerService.host.positionToLineOffset(file, span.start),
|
||||
end: compilerService.host.positionToLineOffset(file, span.start + span.length)
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -738,49 +744,50 @@ module ts.server {
|
||||
switch (request.command) {
|
||||
case CommandNames.Definition: {
|
||||
var defArgs = <protocol.FileLocationRequestArgs>request.arguments;
|
||||
response = this.getDefinition(defArgs.line, defArgs.col, defArgs.file);
|
||||
response = this.getDefinition(defArgs.line, defArgs.offset, defArgs.file);
|
||||
break;
|
||||
}
|
||||
case CommandNames.References: {
|
||||
var refArgs = <protocol.FileLocationRequestArgs>request.arguments;
|
||||
response = this.getReferences(refArgs.line, refArgs.col, refArgs.file);
|
||||
response = this.getReferences(refArgs.line, refArgs.offset, refArgs.file);
|
||||
break;
|
||||
}
|
||||
case CommandNames.Rename: {
|
||||
var renameArgs = <protocol.RenameRequestArgs>request.arguments;
|
||||
response = this.getRenameLocations(renameArgs.line, renameArgs.col, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings);
|
||||
response = this.getRenameLocations(renameArgs.line, renameArgs.offset, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings);
|
||||
break;
|
||||
}
|
||||
case CommandNames.Open: {
|
||||
var openArgs = <protocol.FileRequestArgs>request.arguments;
|
||||
this.openClientFile(openArgs.file);
|
||||
var openArgs = <protocol.OpenRequestArgs>request.arguments;
|
||||
this.openClientFile(openArgs.file,openArgs.tabSize, openArgs.indentSize);
|
||||
responseRequired = false;
|
||||
break;
|
||||
}
|
||||
case CommandNames.Quickinfo: {
|
||||
var quickinfoArgs = <protocol.FileLocationRequestArgs>request.arguments;
|
||||
response = this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.col, quickinfoArgs.file);
|
||||
response = this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.offset, quickinfoArgs.file);
|
||||
break;
|
||||
}
|
||||
case CommandNames.Format: {
|
||||
var formatArgs = <protocol.FormatRequestArgs>request.arguments;
|
||||
response = this.getFormattingEditsForRange(formatArgs.line, formatArgs.col, formatArgs.endLine, formatArgs.endCol, formatArgs.file);
|
||||
response = this.getFormattingEditsForRange(formatArgs.line, formatArgs.offset, formatArgs.endLine, formatArgs.endOffset, formatArgs.file);
|
||||
break;
|
||||
}
|
||||
case CommandNames.Formatonkey: {
|
||||
var formatOnKeyArgs = <protocol.FormatOnKeyRequestArgs>request.arguments;
|
||||
response = this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.col, formatOnKeyArgs.key, formatOnKeyArgs.file);
|
||||
response = this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.offset, formatOnKeyArgs.key, formatOnKeyArgs.file);
|
||||
break;
|
||||
}
|
||||
case CommandNames.Completions: {
|
||||
var completionsArgs = <protocol.CompletionsRequestArgs>request.arguments;
|
||||
response = this.getCompletions(request.arguments.line, request.arguments.col, completionsArgs.prefix, request.arguments.file);
|
||||
response = this.getCompletions(completionsArgs.line, completionsArgs.offset, completionsArgs.prefix, completionsArgs.file);
|
||||
break;
|
||||
}
|
||||
case CommandNames.CompletionDetails: {
|
||||
var completionDetailsArgs = <protocol.CompletionDetailsRequestArgs>request.arguments;
|
||||
response = this.getCompletionEntryDetails(request.arguments.line, request.arguments.col, completionDetailsArgs.entryNames,
|
||||
request.arguments.file);
|
||||
response =
|
||||
this.getCompletionEntryDetails(completionDetailsArgs.line,completionDetailsArgs.offset,
|
||||
completionDetailsArgs.entryNames,completionDetailsArgs.file);
|
||||
break;
|
||||
}
|
||||
case CommandNames.Geterr: {
|
||||
@@ -791,14 +798,22 @@ module ts.server {
|
||||
}
|
||||
case CommandNames.Change: {
|
||||
var changeArgs = <protocol.ChangeRequestArgs>request.arguments;
|
||||
this.change(changeArgs.line, changeArgs.col, changeArgs.endLine, changeArgs.endCol,
|
||||
this.change(changeArgs.line, changeArgs.offset, changeArgs.endLine, changeArgs.endOffset,
|
||||
changeArgs.insertString, changeArgs.file);
|
||||
responseRequired = false;
|
||||
break;
|
||||
}
|
||||
case CommandNames.Configure: {
|
||||
var configureArgs = <protocol.ConfigureRequestArguments>request.arguments;
|
||||
this.projectService.setHostConfiguration(configureArgs);
|
||||
this.output(undefined, CommandNames.Configure, request.seq);
|
||||
responseRequired = false;
|
||||
break;
|
||||
}
|
||||
case CommandNames.Reload: {
|
||||
var reloadArgs = <protocol.ReloadRequestArgs>request.arguments;
|
||||
this.reload(reloadArgs.file, reloadArgs.tmpfile, request.seq);
|
||||
responseRequired = false;
|
||||
break;
|
||||
}
|
||||
case CommandNames.Saveto: {
|
||||
@@ -820,7 +835,7 @@ module ts.server {
|
||||
}
|
||||
case CommandNames.Brace: {
|
||||
var braceArguments = <protocol.FileLocationRequestArgs>request.arguments;
|
||||
response = this.getBraceMatching(braceArguments.line, braceArguments.col, braceArguments.file);
|
||||
response = this.getBraceMatching(braceArguments.line, braceArguments.offset, braceArguments.file);
|
||||
break;
|
||||
}
|
||||
case CommandNames.NavBar: {
|
||||
|
||||
@@ -173,6 +173,10 @@ module ts.BreakpointResolver {
|
||||
return textSpan(node, (<ThrowStatement>node).expression);
|
||||
|
||||
case SyntaxKind.ExportAssignment:
|
||||
if (!(<ExportAssignment>node).expression) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// span on export = id
|
||||
return textSpan(node, (<ExportAssignment>node).expression);
|
||||
|
||||
|
||||
@@ -1008,10 +1008,20 @@ module ts.formatting {
|
||||
return SyntaxKind.Unknown;
|
||||
}
|
||||
|
||||
let internedTabsIndentation: string[];
|
||||
let internedSpacesIndentation: string[];
|
||||
var internedSizes: { tabSize: number; indentSize: number };
|
||||
var internedTabsIndentation: string[];
|
||||
var internedSpacesIndentation: string[];
|
||||
|
||||
export function getIndentationString(indentation: number, options: FormatCodeOptions): string {
|
||||
// reset interned strings if FormatCodeOptions were changed
|
||||
let resetInternedStrings =
|
||||
!internedSizes || (internedSizes.tabSize !== options.TabSize || internedSizes.indentSize !== options.IndentSize);
|
||||
|
||||
if (resetInternedStrings) {
|
||||
internedSizes = { tabSize: options.TabSize, indentSize: options.IndentSize };
|
||||
internedTabsIndentation = internedSpacesIndentation = undefined;
|
||||
}
|
||||
|
||||
if (!options.ConvertTabsToSpaces) {
|
||||
let tabs = Math.floor(indentation / options.TabSize);
|
||||
let spaces = indentation - tabs * options.TabSize;
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
module ts.formatting {
|
||||
|
||||
var internedTabsIndentation: string[];
|
||||
var internedSpacesIndentation: string[];
|
||||
|
||||
export function getIndentationString(indentation: number, options: FormatCodeOptions): string {
|
||||
if (!options.ConvertTabsToSpaces) {
|
||||
var tabs = Math.floor(indentation / options.TabSize);
|
||||
var spaces = indentation - tabs * options.TabSize;
|
||||
|
||||
var tabString: string;
|
||||
if (!internedTabsIndentation) {
|
||||
internedTabsIndentation = [];
|
||||
}
|
||||
|
||||
if (internedTabsIndentation[tabs] === undefined) {
|
||||
internedTabsIndentation[tabs] = tabString = repeat('\t', tabs);
|
||||
}
|
||||
else {
|
||||
tabString = internedTabsIndentation[tabs];
|
||||
}
|
||||
|
||||
return spaces ? tabString + repeat(" ", spaces) : tabString;
|
||||
}
|
||||
else {
|
||||
var spacesString: string;
|
||||
var quotient = Math.floor(indentation / options.IndentSize);
|
||||
var remainder = indentation % options.IndentSize;
|
||||
if (!internedSpacesIndentation) {
|
||||
internedSpacesIndentation = [];
|
||||
}
|
||||
|
||||
if (internedSpacesIndentation[quotient] === undefined) {
|
||||
spacesString = repeat(" ", options.IndentSize * quotient);
|
||||
internedSpacesIndentation[quotient] = spacesString;
|
||||
}
|
||||
else {
|
||||
spacesString = internedSpacesIndentation[quotient];
|
||||
}
|
||||
|
||||
|
||||
return remainder ? spacesString + repeat(" ", remainder) : spacesString;
|
||||
}
|
||||
|
||||
function repeat(value: string, count: number): string {
|
||||
var s = "";
|
||||
for (var i = 0; i < count; ++i) {
|
||||
s += value;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -215,11 +215,7 @@ module ts.formatting {
|
||||
function getStartLineAndCharacterForNode(n: Node, sourceFile: SourceFile): LineAndCharacter {
|
||||
return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile));
|
||||
}
|
||||
|
||||
function positionBelongsToNode(candidate: Node, position: number, sourceFile: SourceFile): boolean {
|
||||
return candidate.end > position || !isCompletedNode(candidate, sourceFile);
|
||||
}
|
||||
|
||||
|
||||
export function childStartsOnTheSameLineWithElseInIfStatement(parent: Node, child: TextRangeWithKind, childStartLine: number, sourceFile: SourceFile): boolean {
|
||||
if (parent.kind === SyntaxKind.IfStatement && (<IfStatement>parent).elseStatement === child) {
|
||||
let elseKeyword = findChildOfKind(parent, SyntaxKind.ElseKeyword, sourceFile);
|
||||
@@ -359,6 +355,7 @@ module ts.formatting {
|
||||
case SyntaxKind.ModuleBlock:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.TypeLiteral:
|
||||
case SyntaxKind.TupleType:
|
||||
case SyntaxKind.CaseBlock:
|
||||
case SyntaxKind.DefaultClause:
|
||||
case SyntaxKind.CaseClause:
|
||||
@@ -370,6 +367,8 @@ module ts.formatting {
|
||||
case SyntaxKind.ExportAssignment:
|
||||
case SyntaxKind.ReturnStatement:
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
case SyntaxKind.ArrayBindingPattern:
|
||||
case SyntaxKind.ObjectBindingPattern:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -390,6 +389,7 @@ module ts.formatting {
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.CallSignature:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
@@ -399,88 +399,5 @@ module ts.formatting {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks if node ends with 'expectedLastToken'.
|
||||
* If child at position 'length - 1' is 'SemicolonToken' it is skipped and 'expectedLastToken' is compared with child at position 'length - 2'.
|
||||
*/
|
||||
function nodeEndsWith(n: Node, expectedLastToken: SyntaxKind, sourceFile: SourceFile): boolean {
|
||||
let children = n.getChildren(sourceFile);
|
||||
if (children.length) {
|
||||
let last = children[children.length - 1];
|
||||
if (last.kind === expectedLastToken) {
|
||||
return true;
|
||||
}
|
||||
else if (last.kind === SyntaxKind.SemicolonToken && children.length !== 1) {
|
||||
return children[children.length - 2].kind === expectedLastToken;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is always called when position of the cursor is located after the node
|
||||
*/
|
||||
function isCompletedNode(n: Node, sourceFile: SourceFile): boolean {
|
||||
if (n.getFullWidth() === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (n.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
case SyntaxKind.CaseBlock:
|
||||
return nodeEndsWith(n, SyntaxKind.CloseBraceToken, sourceFile);
|
||||
case SyntaxKind.CatchClause:
|
||||
return isCompletedNode((<CatchClause>n).block, sourceFile);
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
case SyntaxKind.CallSignature:
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.ConstructSignature:
|
||||
return nodeEndsWith(n, SyntaxKind.CloseParenToken, sourceFile);
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
return !(<FunctionLikeDeclaration>n).body || isCompletedNode((<FunctionLikeDeclaration>n).body, sourceFile);
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
return (<ModuleDeclaration>n).body && isCompletedNode((<ModuleDeclaration>n).body, sourceFile);
|
||||
case SyntaxKind.IfStatement:
|
||||
if ((<IfStatement>n).elseStatement) {
|
||||
return isCompletedNode((<IfStatement>n).elseStatement, sourceFile);
|
||||
}
|
||||
return isCompletedNode((<IfStatement>n).thenStatement, sourceFile);
|
||||
case SyntaxKind.ExpressionStatement:
|
||||
return isCompletedNode((<ExpressionStatement>n).expression, sourceFile);
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
return nodeEndsWith(n, SyntaxKind.CloseBracketToken, sourceFile);
|
||||
case SyntaxKind.CaseClause:
|
||||
case SyntaxKind.DefaultClause:
|
||||
// there is no such thing as terminator token for CaseClause\DefaultClause so for simplicitly always consider them non-completed
|
||||
return false;
|
||||
case SyntaxKind.ForStatement:
|
||||
return isCompletedNode((<ForStatement>n).statement, sourceFile);
|
||||
case SyntaxKind.ForInStatement:
|
||||
return isCompletedNode((<ForInStatement>n).statement, sourceFile);
|
||||
case SyntaxKind.ForOfStatement:
|
||||
return isCompletedNode((<ForOfStatement>n).statement, sourceFile);
|
||||
case SyntaxKind.WhileStatement:
|
||||
return isCompletedNode((<WhileStatement>n).statement, sourceFile);
|
||||
case SyntaxKind.DoStatement:
|
||||
// rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')';
|
||||
let hasWhileKeyword = findChildOfKind(n, SyntaxKind.WhileKeyword, sourceFile);
|
||||
if (hasWhileKeyword) {
|
||||
return nodeEndsWith(n, SyntaxKind.CloseParenToken, sourceFile);
|
||||
}
|
||||
return isCompletedNode((<DoStatement>n).statement, sourceFile);
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -418,10 +418,10 @@ module ts.NavigationBar {
|
||||
}
|
||||
|
||||
function createFunctionItem(node: FunctionDeclaration) {
|
||||
if (node.name && node.body && node.body.kind === SyntaxKind.Block) {
|
||||
if ((node.name || node.flags & NodeFlags.Default) && node.body && node.body.kind === SyntaxKind.Block) {
|
||||
let childItems = getItemsWorker(sortNodes((<Block>node.body).statements), createChildItem);
|
||||
|
||||
return getNavigationBarItem(node.name.text,
|
||||
return getNavigationBarItem((!node.name && node.flags & NodeFlags.Default) ? "default": node.name.text ,
|
||||
ts.ScriptElementKind.functionElement,
|
||||
getNodeModifiers(node),
|
||||
[getNodeSpan(node)],
|
||||
@@ -452,11 +452,6 @@ module ts.NavigationBar {
|
||||
}
|
||||
|
||||
function createClassItem(node: ClassDeclaration): ts.NavigationBarItem {
|
||||
if (!node.name) {
|
||||
// An export default class may be nameless
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let childItems: NavigationBarItem[];
|
||||
|
||||
if (node.members) {
|
||||
@@ -475,8 +470,10 @@ module ts.NavigationBar {
|
||||
childItems = getItemsWorker(sortNodes(nodes), createChildItem);
|
||||
}
|
||||
|
||||
var nodeName = !node.name && (node.flags & NodeFlags.Default) ? "default" : node.name.text;
|
||||
|
||||
return getNavigationBarItem(
|
||||
node.name.text,
|
||||
nodeName,
|
||||
ts.ScriptElementKind.classElement,
|
||||
getNodeModifiers(node),
|
||||
[getNodeSpan(node)],
|
||||
|
||||
+26
-23
@@ -2597,8 +2597,9 @@ module ts {
|
||||
isNewIdentifierLocation = isNewIdentifierDefinitionLocation(previousToken);
|
||||
|
||||
/// TODO filter meaning based on the current context
|
||||
let scopeNode = getScopeNode(previousToken, position, sourceFile);
|
||||
let symbolMeanings = SymbolFlags.Type | SymbolFlags.Value | SymbolFlags.Namespace | SymbolFlags.Alias;
|
||||
let symbols = typeInfoResolver.getSymbolsInScope(node, symbolMeanings);
|
||||
let symbols = typeInfoResolver.getSymbolsInScope(scopeNode, symbolMeanings);
|
||||
|
||||
getCompletionEntriesFromSymbols(symbols, activeCompletionSession);
|
||||
}
|
||||
@@ -2613,10 +2614,22 @@ module ts {
|
||||
return {
|
||||
isMemberCompletion,
|
||||
isNewIdentifierLocation,
|
||||
isBuilder : isNewIdentifierDefinitionLocation, // temporary property used to match VS implementation
|
||||
isBuilder: isNewIdentifierDefinitionLocation, // temporary property used to match VS implementation
|
||||
entries: activeCompletionSession.entries
|
||||
};
|
||||
|
||||
/**
|
||||
* Finds the first node that "embraces" the position, so that one may
|
||||
* accurately aggregate locals from the closest containing scope.
|
||||
*/
|
||||
function getScopeNode(initialToken: Node, position: number, sourceFile: SourceFile) {
|
||||
var scope = initialToken;
|
||||
while (scope && !positionBelongsToNode(scope, position, sourceFile)) {
|
||||
scope = scope.parent;
|
||||
}
|
||||
return scope;
|
||||
}
|
||||
|
||||
function getCompletionEntriesFromSymbols(symbols: Symbol[], session: CompletionSession): void {
|
||||
let start = new Date().getTime();
|
||||
forEach(symbols, symbol => {
|
||||
@@ -3479,7 +3492,6 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
let result: DefinitionInfo[] = [];
|
||||
|
||||
// Because name in short-hand property assignment has two different meanings: property name and property value,
|
||||
// using go-to-definition at such position should go to the variable declaration of the property value rather than
|
||||
@@ -3488,16 +3500,19 @@ module ts {
|
||||
// assignment. This case and others are handled by the following code.
|
||||
if (node.parent.kind === SyntaxKind.ShorthandPropertyAssignment) {
|
||||
let shorthandSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
|
||||
if (!shorthandSymbol) {
|
||||
return [];
|
||||
}
|
||||
|
||||
let shorthandDeclarations = shorthandSymbol.getDeclarations();
|
||||
let shorthandSymbolKind = getSymbolKind(shorthandSymbol, typeInfoResolver, node);
|
||||
let shorthandSymbolName = typeInfoResolver.symbolToString(shorthandSymbol);
|
||||
let shorthandContainerName = typeInfoResolver.symbolToString(symbol.parent, node);
|
||||
forEach(shorthandDeclarations, declaration => {
|
||||
result.push(getDefinitionInfo(declaration, shorthandSymbolKind, shorthandSymbolName, shorthandContainerName));
|
||||
});
|
||||
return result
|
||||
return map(shorthandDeclarations,
|
||||
declaration => getDefinitionInfo(declaration, shorthandSymbolKind, shorthandSymbolName, shorthandContainerName));
|
||||
}
|
||||
|
||||
let result: DefinitionInfo[] = [];
|
||||
let declarations = symbol.getDeclarations();
|
||||
let symbolName = typeInfoResolver.symbolToString(symbol); // Do not get scoped name, just the name of the symbol
|
||||
let symbolKind = getSymbolKind(symbol, typeInfoResolver, node);
|
||||
@@ -4011,18 +4026,18 @@ module ts {
|
||||
let container = declaration.parent;
|
||||
|
||||
// Make sure we only highlight the keyword when it makes sense to do so.
|
||||
if (declaration.flags & NodeFlags.AccessibilityModifier) {
|
||||
if (isAccessibilityModifier(modifier)) {
|
||||
if (!(container.kind === SyntaxKind.ClassDeclaration ||
|
||||
(declaration.kind === SyntaxKind.Parameter && hasKind(container, SyntaxKind.Constructor)))) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else if (declaration.flags & NodeFlags.Static) {
|
||||
else if (modifier === SyntaxKind.StaticKeyword) {
|
||||
if (container.kind !== SyntaxKind.ClassDeclaration) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else if (declaration.flags & (NodeFlags.Export | NodeFlags.Ambient)) {
|
||||
else if (modifier === SyntaxKind.ExportKeyword || modifier === SyntaxKind.DeclareKeyword) {
|
||||
if (!(container.kind === SyntaxKind.ModuleBlock || container.kind === SyntaxKind.SourceFile)) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -4063,7 +4078,7 @@ module ts {
|
||||
default:
|
||||
Debug.fail("Invalid container kind.")
|
||||
}
|
||||
|
||||
|
||||
forEach(nodes, node => {
|
||||
if (node.modifiers && node.flags & modifierFlag) {
|
||||
forEach(node.modifiers, child => pushKeywordIf(keywords, child, modifier));
|
||||
@@ -4899,7 +4914,6 @@ module ts {
|
||||
synchronizeHostData();
|
||||
|
||||
let sourceFile = getValidSourceFile(fileName);
|
||||
|
||||
let outputFiles: OutputFile[] = [];
|
||||
|
||||
function writeFile(fileName: string, data: string, writeByteOrderMark: boolean) {
|
||||
@@ -5843,17 +5857,6 @@ module ts {
|
||||
// a string literal, and a template end consisting of '} } `'.
|
||||
let templateStack: SyntaxKind[] = [];
|
||||
|
||||
function isAccessibilityModifier(kind: SyntaxKind) {
|
||||
switch (kind) {
|
||||
case SyntaxKind.PublicKeyword:
|
||||
case SyntaxKind.PrivateKeyword:
|
||||
case SyntaxKind.ProtectedKeyword:
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Returns true if 'keyword2' can legally follow 'keyword1' in any language construct. */
|
||||
function canFollow(keyword1: SyntaxKind, keyword2: SyntaxKind) {
|
||||
if (isAccessibilityModifier(keyword1)) {
|
||||
|
||||
@@ -833,3 +833,5 @@ module ts {
|
||||
module TypeScript.Services {
|
||||
export var TypeScriptServicesFactory = ts.TypeScriptServicesFactory;
|
||||
}
|
||||
|
||||
let toolsVersion = "1.4";
|
||||
|
||||
@@ -59,6 +59,157 @@ module ts {
|
||||
return start < end;
|
||||
}
|
||||
|
||||
export function positionBelongsToNode(candidate: Node, position: number, sourceFile: SourceFile): boolean {
|
||||
return candidate.end > position || !isCompletedNode(candidate, sourceFile);
|
||||
}
|
||||
|
||||
export function isCompletedNode(n: Node, sourceFile: SourceFile): boolean {
|
||||
if (nodeIsMissing(n)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (n.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.ObjectBindingPattern:
|
||||
case SyntaxKind.TypeLiteral:
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
case SyntaxKind.CaseBlock:
|
||||
return nodeEndsWith(n, SyntaxKind.CloseBraceToken, sourceFile);
|
||||
case SyntaxKind.CatchClause:
|
||||
return isCompletedNode((<CatchClause>n).block, sourceFile);
|
||||
case SyntaxKind.NewExpression:
|
||||
if (!(<NewExpression>n).arguments) {
|
||||
return true;
|
||||
}
|
||||
// fall through
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
case SyntaxKind.ParenthesizedType:
|
||||
return nodeEndsWith(n, SyntaxKind.CloseParenToken, sourceFile);
|
||||
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.ConstructorType:
|
||||
return isCompletedNode((<SignatureDeclaration>n).type, sourceFile);
|
||||
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.ConstructSignature:
|
||||
case SyntaxKind.CallSignature:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
if ((<FunctionLikeDeclaration>n).body) {
|
||||
return isCompletedNode((<FunctionLikeDeclaration>n).body, sourceFile);
|
||||
}
|
||||
|
||||
if ((<FunctionLikeDeclaration>n).type) {
|
||||
return isCompletedNode((<FunctionLikeDeclaration>n).type, sourceFile);
|
||||
}
|
||||
|
||||
// Even though type parameters can be unclosed, we can get away with
|
||||
// having at least a closing paren.
|
||||
return hasChildOfKind(n, SyntaxKind.CloseParenToken, sourceFile);
|
||||
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
return (<ModuleDeclaration>n).body && isCompletedNode((<ModuleDeclaration>n).body, sourceFile);
|
||||
|
||||
case SyntaxKind.IfStatement:
|
||||
if ((<IfStatement>n).elseStatement) {
|
||||
return isCompletedNode((<IfStatement>n).elseStatement, sourceFile);
|
||||
}
|
||||
return isCompletedNode((<IfStatement>n).thenStatement, sourceFile);
|
||||
|
||||
case SyntaxKind.ExpressionStatement:
|
||||
return isCompletedNode((<ExpressionStatement>n).expression, sourceFile);
|
||||
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
case SyntaxKind.ArrayBindingPattern:
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
case SyntaxKind.ComputedPropertyName:
|
||||
case SyntaxKind.TupleType:
|
||||
return nodeEndsWith(n, SyntaxKind.CloseBracketToken, sourceFile);
|
||||
|
||||
case SyntaxKind.IndexSignature:
|
||||
if ((<IndexSignatureDeclaration>n).type) {
|
||||
return isCompletedNode((<IndexSignatureDeclaration>n).type, sourceFile);
|
||||
}
|
||||
|
||||
return hasChildOfKind(n, SyntaxKind.CloseBracketToken, sourceFile);
|
||||
|
||||
case SyntaxKind.CaseClause:
|
||||
case SyntaxKind.DefaultClause:
|
||||
// there is no such thing as terminator token for CaseClause/DefaultClause so for simplicitly always consider them non-completed
|
||||
return false;
|
||||
|
||||
case SyntaxKind.ForStatement:
|
||||
case SyntaxKind.ForInStatement:
|
||||
case SyntaxKind.ForOfStatement:
|
||||
case SyntaxKind.WhileStatement:
|
||||
return isCompletedNode((<IterationStatement>n).statement, sourceFile);
|
||||
case SyntaxKind.DoStatement:
|
||||
// rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')';
|
||||
let hasWhileKeyword = findChildOfKind(n, SyntaxKind.WhileKeyword, sourceFile);
|
||||
if (hasWhileKeyword) {
|
||||
return nodeEndsWith(n, SyntaxKind.CloseParenToken, sourceFile);
|
||||
}
|
||||
return isCompletedNode((<DoStatement>n).statement, sourceFile);
|
||||
|
||||
case SyntaxKind.TypeQuery:
|
||||
return isCompletedNode((<TypeQueryNode>n).exprName, sourceFile);
|
||||
|
||||
case SyntaxKind.TypeOfExpression:
|
||||
case SyntaxKind.DeleteExpression:
|
||||
case SyntaxKind.VoidExpression:
|
||||
case SyntaxKind.YieldExpression:
|
||||
case SyntaxKind.SpreadElementExpression:
|
||||
let unaryWordExpression = (<TypeOfExpression|DeleteExpression|VoidExpression|YieldExpression|SpreadElementExpression>n);
|
||||
return isCompletedNode(unaryWordExpression.expression, sourceFile);
|
||||
|
||||
case SyntaxKind.TaggedTemplateExpression:
|
||||
return isCompletedNode((<TaggedTemplateExpression>n).template, sourceFile);
|
||||
case SyntaxKind.TemplateExpression:
|
||||
let lastSpan = lastOrUndefined((<TemplateExpression>n).templateSpans);
|
||||
return isCompletedNode(lastSpan, sourceFile);
|
||||
case SyntaxKind.TemplateSpan:
|
||||
return nodeIsPresent((<TemplateSpan>n).literal);
|
||||
|
||||
case SyntaxKind.PrefixUnaryExpression:
|
||||
return isCompletedNode((<PrefixUnaryExpression>n).operand, sourceFile);
|
||||
case SyntaxKind.BinaryExpression:
|
||||
return isCompletedNode((<BinaryExpression>n).right, sourceFile);
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
return isCompletedNode((<ConditionalExpression>n).whenFalse, sourceFile);
|
||||
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks if node ends with 'expectedLastToken'.
|
||||
* If child at position 'length - 1' is 'SemicolonToken' it is skipped and 'expectedLastToken' is compared with child at position 'length - 2'.
|
||||
*/
|
||||
function nodeEndsWith(n: Node, expectedLastToken: SyntaxKind, sourceFile: SourceFile): boolean {
|
||||
let children = n.getChildren(sourceFile);
|
||||
if (children.length) {
|
||||
let last = children[children.length - 1];
|
||||
if (last.kind === expectedLastToken) {
|
||||
return true;
|
||||
}
|
||||
else if (last.kind === SyntaxKind.SemicolonToken && children.length !== 1) {
|
||||
return children[children.length - 2].kind === expectedLastToken;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function findListItemInfo(node: Node): ListItemInfo {
|
||||
let list = findContainingList(node);
|
||||
|
||||
@@ -79,6 +230,10 @@ module ts {
|
||||
};
|
||||
}
|
||||
|
||||
export function hasChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): boolean {
|
||||
return !!findChildOfKind(n, kind, sourceFile);
|
||||
}
|
||||
|
||||
export function findChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): Node {
|
||||
return forEach(n.getChildren(sourceFile), c => c.kind === kind && c);
|
||||
}
|
||||
@@ -316,6 +471,17 @@ module ts {
|
||||
&& (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd());
|
||||
}
|
||||
|
||||
export function isAccessibilityModifier(kind: SyntaxKind) {
|
||||
switch (kind) {
|
||||
case SyntaxKind.PublicKeyword:
|
||||
case SyntaxKind.PrivateKeyword:
|
||||
case SyntaxKind.ProtectedKeyword:
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function compareDataObjects(dst: any, src: any): boolean {
|
||||
for (let e in dst) {
|
||||
if (typeof dst[e] === "object") {
|
||||
|
||||
@@ -554,6 +554,9 @@ declare module "typescript" {
|
||||
name?: Identifier;
|
||||
body: Block | Expression;
|
||||
}
|
||||
interface ArrowFunction extends Expression, FunctionLikeDeclaration {
|
||||
equalsGreaterThanToken: Node;
|
||||
}
|
||||
interface LiteralExpression extends PrimaryExpression {
|
||||
text: string;
|
||||
isUnterminated?: boolean;
|
||||
@@ -763,7 +766,8 @@ declare module "typescript" {
|
||||
type ExportSpecifier = ImportOrExportSpecifier;
|
||||
interface ExportAssignment extends Declaration, ModuleElement {
|
||||
isExportEquals?: boolean;
|
||||
expression: Expression;
|
||||
expression?: Expression;
|
||||
type?: TypeNode;
|
||||
}
|
||||
interface FileReference extends TextRange {
|
||||
fileName: string;
|
||||
@@ -798,14 +802,14 @@ declare module "typescript" {
|
||||
interface Program extends ScriptReferenceHost {
|
||||
getSourceFiles(): SourceFile[];
|
||||
/**
|
||||
* Emits the javascript and declaration files. If targetSourceFile is not specified, then
|
||||
* the javascript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the javascript and declaration for that
|
||||
* Emits the JavaScript and declaration files. If targetSourceFile is not specified, then
|
||||
* the JavaScript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the JavaScript and declaration for that
|
||||
* specific file will be generated.
|
||||
*
|
||||
* If writeFile is not specified then the writeFile callback from the compiler host will be
|
||||
* used for writing the javascript and declaration files. Otherwise, the writeFile parameter
|
||||
* will be invoked when writing the javascript and declaration files.
|
||||
* used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter
|
||||
* will be invoked when writing the JavaScript and declaration files.
|
||||
*/
|
||||
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult;
|
||||
getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
@@ -924,9 +928,10 @@ declare module "typescript" {
|
||||
NotAccessible = 1,
|
||||
CannotBeNamed = 2,
|
||||
}
|
||||
type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
interface SymbolVisibilityResult {
|
||||
accessibility: SymbolAccessibility;
|
||||
aliasesToMakeVisible?: ImportEqualsDeclaration[];
|
||||
aliasesToMakeVisible?: AnyImportSyntax[];
|
||||
errorSymbolName?: string;
|
||||
errorNode?: Node;
|
||||
}
|
||||
@@ -936,14 +941,16 @@ declare module "typescript" {
|
||||
interface EmitResolver {
|
||||
getGeneratedNameForNode(node: Node): string;
|
||||
getExpressionNameSubstitution(node: Identifier): string;
|
||||
isValueExportDeclaration(node: Node): boolean;
|
||||
isValueAliasDeclaration(node: Node): boolean;
|
||||
isReferencedAliasDeclaration(node: Node): boolean;
|
||||
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
|
||||
getNodeCheckFlags(node: Node): NodeCheckFlags;
|
||||
isDeclarationVisible(node: Declaration): boolean;
|
||||
collectLinkedAliases(node: Identifier): Node[];
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
@@ -1173,17 +1180,6 @@ declare module "typescript" {
|
||||
interface TypeMapper {
|
||||
(t: Type): Type;
|
||||
}
|
||||
interface TypeInferences {
|
||||
primary: Type[];
|
||||
secondary: Type[];
|
||||
}
|
||||
interface InferenceContext {
|
||||
typeParameters: TypeParameter[];
|
||||
inferUnionTypes: boolean;
|
||||
inferences: TypeInferences[];
|
||||
inferredTypes: Type[];
|
||||
failedTypeParameterIndex?: number;
|
||||
}
|
||||
interface DiagnosticMessage {
|
||||
key: string;
|
||||
category: DiagnosticCategory;
|
||||
@@ -1480,7 +1476,7 @@ declare module "typescript" {
|
||||
declare module "typescript" {
|
||||
/** The version of the TypeScript compiler release */
|
||||
let version: string;
|
||||
function createCompilerHost(options: CompilerOptions): CompilerHost;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
function getPreEmitDiagnostics(program: Program): Diagnostic[];
|
||||
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
|
||||
|
||||
@@ -1671,6 +1671,15 @@ declare module "typescript" {
|
||||
>body : Expression | Block
|
||||
>Block : Block
|
||||
>Expression : Expression
|
||||
}
|
||||
interface ArrowFunction extends Expression, FunctionLikeDeclaration {
|
||||
>ArrowFunction : ArrowFunction
|
||||
>Expression : Expression
|
||||
>FunctionLikeDeclaration : FunctionLikeDeclaration
|
||||
|
||||
equalsGreaterThanToken: Node;
|
||||
>equalsGreaterThanToken : Node
|
||||
>Node : Node
|
||||
}
|
||||
interface LiteralExpression extends PrimaryExpression {
|
||||
>LiteralExpression : LiteralExpression
|
||||
@@ -2327,9 +2336,13 @@ declare module "typescript" {
|
||||
isExportEquals?: boolean;
|
||||
>isExportEquals : boolean
|
||||
|
||||
expression: Expression;
|
||||
expression?: Expression;
|
||||
>expression : Expression
|
||||
>Expression : Expression
|
||||
|
||||
type?: TypeNode;
|
||||
>type : TypeNode
|
||||
>TypeNode : TypeNode
|
||||
}
|
||||
interface FileReference extends TextRange {
|
||||
>FileReference : FileReference
|
||||
@@ -2430,14 +2443,14 @@ declare module "typescript" {
|
||||
>SourceFile : SourceFile
|
||||
|
||||
/**
|
||||
* Emits the javascript and declaration files. If targetSourceFile is not specified, then
|
||||
* the javascript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the javascript and declaration for that
|
||||
* Emits the JavaScript and declaration files. If targetSourceFile is not specified, then
|
||||
* the JavaScript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the JavaScript and declaration for that
|
||||
* specific file will be generated.
|
||||
*
|
||||
* If writeFile is not specified then the writeFile callback from the compiler host will be
|
||||
* used for writing the javascript and declaration files. Otherwise, the writeFile parameter
|
||||
* will be invoked when writing the javascript and declaration files.
|
||||
* used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter
|
||||
* will be invoked when writing the JavaScript and declaration files.
|
||||
*/
|
||||
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult;
|
||||
>emit : (targetSourceFile?: SourceFile, writeFile?: WriteFileCallback) => EmitResult
|
||||
@@ -2960,6 +2973,11 @@ declare module "typescript" {
|
||||
CannotBeNamed = 2,
|
||||
>CannotBeNamed : SymbolAccessibility
|
||||
}
|
||||
type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
>AnyImportSyntax : ImportEqualsDeclaration | ImportDeclaration
|
||||
>ImportDeclaration : ImportDeclaration
|
||||
>ImportEqualsDeclaration : ImportEqualsDeclaration
|
||||
|
||||
interface SymbolVisibilityResult {
|
||||
>SymbolVisibilityResult : SymbolVisibilityResult
|
||||
|
||||
@@ -2967,9 +2985,9 @@ declare module "typescript" {
|
||||
>accessibility : SymbolAccessibility
|
||||
>SymbolAccessibility : SymbolAccessibility
|
||||
|
||||
aliasesToMakeVisible?: ImportEqualsDeclaration[];
|
||||
>aliasesToMakeVisible : ImportEqualsDeclaration[]
|
||||
>ImportEqualsDeclaration : ImportEqualsDeclaration
|
||||
aliasesToMakeVisible?: AnyImportSyntax[];
|
||||
>aliasesToMakeVisible : (ImportEqualsDeclaration | ImportDeclaration)[]
|
||||
>AnyImportSyntax : ImportEqualsDeclaration | ImportDeclaration
|
||||
|
||||
errorSymbolName?: string;
|
||||
>errorSymbolName : string
|
||||
@@ -2998,8 +3016,8 @@ declare module "typescript" {
|
||||
>node : Identifier
|
||||
>Identifier : Identifier
|
||||
|
||||
isValueExportDeclaration(node: Node): boolean;
|
||||
>isValueExportDeclaration : (node: Node) => boolean
|
||||
isValueAliasDeclaration(node: Node): boolean;
|
||||
>isValueAliasDeclaration : (node: Node) => boolean
|
||||
>node : Node
|
||||
>Node : Node
|
||||
|
||||
@@ -3024,6 +3042,12 @@ declare module "typescript" {
|
||||
>node : Declaration
|
||||
>Declaration : Declaration
|
||||
|
||||
collectLinkedAliases(node: Identifier): Node[];
|
||||
>collectLinkedAliases : (node: Identifier) => Node[]
|
||||
>node : Identifier
|
||||
>Identifier : Identifier
|
||||
>Node : Node
|
||||
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
>isImplementationOfOverload : (node: FunctionLikeDeclaration) => boolean
|
||||
>node : FunctionLikeDeclaration
|
||||
@@ -3050,6 +3074,17 @@ declare module "typescript" {
|
||||
>flags : TypeFormatFlags
|
||||
>TypeFormatFlags : TypeFormatFlags
|
||||
>writer : SymbolWriter
|
||||
>SymbolWriter : SymbolWriter
|
||||
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
>writeTypeOfExpression : (expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void
|
||||
>expr : Expression
|
||||
>Expression : Expression
|
||||
>enclosingDeclaration : Node
|
||||
>Node : Node
|
||||
>flags : TypeFormatFlags
|
||||
>TypeFormatFlags : TypeFormatFlags
|
||||
>writer : SymbolWriter
|
||||
>SymbolWriter : SymbolWriter
|
||||
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
@@ -3759,38 +3794,6 @@ declare module "typescript" {
|
||||
>t : Type
|
||||
>Type : Type
|
||||
>Type : Type
|
||||
}
|
||||
interface TypeInferences {
|
||||
>TypeInferences : TypeInferences
|
||||
|
||||
primary: Type[];
|
||||
>primary : Type[]
|
||||
>Type : Type
|
||||
|
||||
secondary: Type[];
|
||||
>secondary : Type[]
|
||||
>Type : Type
|
||||
}
|
||||
interface InferenceContext {
|
||||
>InferenceContext : InferenceContext
|
||||
|
||||
typeParameters: TypeParameter[];
|
||||
>typeParameters : TypeParameter[]
|
||||
>TypeParameter : TypeParameter
|
||||
|
||||
inferUnionTypes: boolean;
|
||||
>inferUnionTypes : boolean
|
||||
|
||||
inferences: TypeInferences[];
|
||||
>inferences : TypeInferences[]
|
||||
>TypeInferences : TypeInferences
|
||||
|
||||
inferredTypes: Type[];
|
||||
>inferredTypes : Type[]
|
||||
>Type : Type
|
||||
|
||||
failedTypeParameterIndex?: number;
|
||||
>failedTypeParameterIndex : number
|
||||
}
|
||||
interface DiagnosticMessage {
|
||||
>DiagnosticMessage : DiagnosticMessage
|
||||
@@ -4736,10 +4739,11 @@ declare module "typescript" {
|
||||
let version: string;
|
||||
>version : string
|
||||
|
||||
function createCompilerHost(options: CompilerOptions): CompilerHost;
|
||||
>createCompilerHost : (options: CompilerOptions) => CompilerHost
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
>createCompilerHost : (options: CompilerOptions, setParentNodes?: boolean) => CompilerHost
|
||||
>options : CompilerOptions
|
||||
>CompilerOptions : CompilerOptions
|
||||
>setParentNodes : boolean
|
||||
>CompilerHost : CompilerHost
|
||||
|
||||
function getPreEmitDiagnostics(program: Program): Diagnostic[];
|
||||
|
||||
@@ -585,6 +585,9 @@ declare module "typescript" {
|
||||
name?: Identifier;
|
||||
body: Block | Expression;
|
||||
}
|
||||
interface ArrowFunction extends Expression, FunctionLikeDeclaration {
|
||||
equalsGreaterThanToken: Node;
|
||||
}
|
||||
interface LiteralExpression extends PrimaryExpression {
|
||||
text: string;
|
||||
isUnterminated?: boolean;
|
||||
@@ -794,7 +797,8 @@ declare module "typescript" {
|
||||
type ExportSpecifier = ImportOrExportSpecifier;
|
||||
interface ExportAssignment extends Declaration, ModuleElement {
|
||||
isExportEquals?: boolean;
|
||||
expression: Expression;
|
||||
expression?: Expression;
|
||||
type?: TypeNode;
|
||||
}
|
||||
interface FileReference extends TextRange {
|
||||
fileName: string;
|
||||
@@ -829,14 +833,14 @@ declare module "typescript" {
|
||||
interface Program extends ScriptReferenceHost {
|
||||
getSourceFiles(): SourceFile[];
|
||||
/**
|
||||
* Emits the javascript and declaration files. If targetSourceFile is not specified, then
|
||||
* the javascript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the javascript and declaration for that
|
||||
* Emits the JavaScript and declaration files. If targetSourceFile is not specified, then
|
||||
* the JavaScript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the JavaScript and declaration for that
|
||||
* specific file will be generated.
|
||||
*
|
||||
* If writeFile is not specified then the writeFile callback from the compiler host will be
|
||||
* used for writing the javascript and declaration files. Otherwise, the writeFile parameter
|
||||
* will be invoked when writing the javascript and declaration files.
|
||||
* used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter
|
||||
* will be invoked when writing the JavaScript and declaration files.
|
||||
*/
|
||||
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult;
|
||||
getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
@@ -955,9 +959,10 @@ declare module "typescript" {
|
||||
NotAccessible = 1,
|
||||
CannotBeNamed = 2,
|
||||
}
|
||||
type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
interface SymbolVisibilityResult {
|
||||
accessibility: SymbolAccessibility;
|
||||
aliasesToMakeVisible?: ImportEqualsDeclaration[];
|
||||
aliasesToMakeVisible?: AnyImportSyntax[];
|
||||
errorSymbolName?: string;
|
||||
errorNode?: Node;
|
||||
}
|
||||
@@ -967,14 +972,16 @@ declare module "typescript" {
|
||||
interface EmitResolver {
|
||||
getGeneratedNameForNode(node: Node): string;
|
||||
getExpressionNameSubstitution(node: Identifier): string;
|
||||
isValueExportDeclaration(node: Node): boolean;
|
||||
isValueAliasDeclaration(node: Node): boolean;
|
||||
isReferencedAliasDeclaration(node: Node): boolean;
|
||||
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
|
||||
getNodeCheckFlags(node: Node): NodeCheckFlags;
|
||||
isDeclarationVisible(node: Declaration): boolean;
|
||||
collectLinkedAliases(node: Identifier): Node[];
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
@@ -1204,17 +1211,6 @@ declare module "typescript" {
|
||||
interface TypeMapper {
|
||||
(t: Type): Type;
|
||||
}
|
||||
interface TypeInferences {
|
||||
primary: Type[];
|
||||
secondary: Type[];
|
||||
}
|
||||
interface InferenceContext {
|
||||
typeParameters: TypeParameter[];
|
||||
inferUnionTypes: boolean;
|
||||
inferences: TypeInferences[];
|
||||
inferredTypes: Type[];
|
||||
failedTypeParameterIndex?: number;
|
||||
}
|
||||
interface DiagnosticMessage {
|
||||
key: string;
|
||||
category: DiagnosticCategory;
|
||||
@@ -1511,7 +1507,7 @@ declare module "typescript" {
|
||||
declare module "typescript" {
|
||||
/** The version of the TypeScript compiler release */
|
||||
let version: string;
|
||||
function createCompilerHost(options: CompilerOptions): CompilerHost;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
function getPreEmitDiagnostics(program: Program): Diagnostic[];
|
||||
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
|
||||
|
||||
@@ -1817,6 +1817,15 @@ declare module "typescript" {
|
||||
>body : Expression | Block
|
||||
>Block : Block
|
||||
>Expression : Expression
|
||||
}
|
||||
interface ArrowFunction extends Expression, FunctionLikeDeclaration {
|
||||
>ArrowFunction : ArrowFunction
|
||||
>Expression : Expression
|
||||
>FunctionLikeDeclaration : FunctionLikeDeclaration
|
||||
|
||||
equalsGreaterThanToken: Node;
|
||||
>equalsGreaterThanToken : Node
|
||||
>Node : Node
|
||||
}
|
||||
interface LiteralExpression extends PrimaryExpression {
|
||||
>LiteralExpression : LiteralExpression
|
||||
@@ -2473,9 +2482,13 @@ declare module "typescript" {
|
||||
isExportEquals?: boolean;
|
||||
>isExportEquals : boolean
|
||||
|
||||
expression: Expression;
|
||||
expression?: Expression;
|
||||
>expression : Expression
|
||||
>Expression : Expression
|
||||
|
||||
type?: TypeNode;
|
||||
>type : TypeNode
|
||||
>TypeNode : TypeNode
|
||||
}
|
||||
interface FileReference extends TextRange {
|
||||
>FileReference : FileReference
|
||||
@@ -2576,14 +2589,14 @@ declare module "typescript" {
|
||||
>SourceFile : SourceFile
|
||||
|
||||
/**
|
||||
* Emits the javascript and declaration files. If targetSourceFile is not specified, then
|
||||
* the javascript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the javascript and declaration for that
|
||||
* Emits the JavaScript and declaration files. If targetSourceFile is not specified, then
|
||||
* the JavaScript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the JavaScript and declaration for that
|
||||
* specific file will be generated.
|
||||
*
|
||||
* If writeFile is not specified then the writeFile callback from the compiler host will be
|
||||
* used for writing the javascript and declaration files. Otherwise, the writeFile parameter
|
||||
* will be invoked when writing the javascript and declaration files.
|
||||
* used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter
|
||||
* will be invoked when writing the JavaScript and declaration files.
|
||||
*/
|
||||
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult;
|
||||
>emit : (targetSourceFile?: SourceFile, writeFile?: WriteFileCallback) => EmitResult
|
||||
@@ -3106,6 +3119,11 @@ declare module "typescript" {
|
||||
CannotBeNamed = 2,
|
||||
>CannotBeNamed : SymbolAccessibility
|
||||
}
|
||||
type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
>AnyImportSyntax : ImportEqualsDeclaration | ImportDeclaration
|
||||
>ImportDeclaration : ImportDeclaration
|
||||
>ImportEqualsDeclaration : ImportEqualsDeclaration
|
||||
|
||||
interface SymbolVisibilityResult {
|
||||
>SymbolVisibilityResult : SymbolVisibilityResult
|
||||
|
||||
@@ -3113,9 +3131,9 @@ declare module "typescript" {
|
||||
>accessibility : SymbolAccessibility
|
||||
>SymbolAccessibility : SymbolAccessibility
|
||||
|
||||
aliasesToMakeVisible?: ImportEqualsDeclaration[];
|
||||
>aliasesToMakeVisible : ImportEqualsDeclaration[]
|
||||
>ImportEqualsDeclaration : ImportEqualsDeclaration
|
||||
aliasesToMakeVisible?: AnyImportSyntax[];
|
||||
>aliasesToMakeVisible : (ImportEqualsDeclaration | ImportDeclaration)[]
|
||||
>AnyImportSyntax : ImportEqualsDeclaration | ImportDeclaration
|
||||
|
||||
errorSymbolName?: string;
|
||||
>errorSymbolName : string
|
||||
@@ -3144,8 +3162,8 @@ declare module "typescript" {
|
||||
>node : Identifier
|
||||
>Identifier : Identifier
|
||||
|
||||
isValueExportDeclaration(node: Node): boolean;
|
||||
>isValueExportDeclaration : (node: Node) => boolean
|
||||
isValueAliasDeclaration(node: Node): boolean;
|
||||
>isValueAliasDeclaration : (node: Node) => boolean
|
||||
>node : Node
|
||||
>Node : Node
|
||||
|
||||
@@ -3170,6 +3188,12 @@ declare module "typescript" {
|
||||
>node : Declaration
|
||||
>Declaration : Declaration
|
||||
|
||||
collectLinkedAliases(node: Identifier): Node[];
|
||||
>collectLinkedAliases : (node: Identifier) => Node[]
|
||||
>node : Identifier
|
||||
>Identifier : Identifier
|
||||
>Node : Node
|
||||
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
>isImplementationOfOverload : (node: FunctionLikeDeclaration) => boolean
|
||||
>node : FunctionLikeDeclaration
|
||||
@@ -3196,6 +3220,17 @@ declare module "typescript" {
|
||||
>flags : TypeFormatFlags
|
||||
>TypeFormatFlags : TypeFormatFlags
|
||||
>writer : SymbolWriter
|
||||
>SymbolWriter : SymbolWriter
|
||||
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
>writeTypeOfExpression : (expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void
|
||||
>expr : Expression
|
||||
>Expression : Expression
|
||||
>enclosingDeclaration : Node
|
||||
>Node : Node
|
||||
>flags : TypeFormatFlags
|
||||
>TypeFormatFlags : TypeFormatFlags
|
||||
>writer : SymbolWriter
|
||||
>SymbolWriter : SymbolWriter
|
||||
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
@@ -3905,38 +3940,6 @@ declare module "typescript" {
|
||||
>t : Type
|
||||
>Type : Type
|
||||
>Type : Type
|
||||
}
|
||||
interface TypeInferences {
|
||||
>TypeInferences : TypeInferences
|
||||
|
||||
primary: Type[];
|
||||
>primary : Type[]
|
||||
>Type : Type
|
||||
|
||||
secondary: Type[];
|
||||
>secondary : Type[]
|
||||
>Type : Type
|
||||
}
|
||||
interface InferenceContext {
|
||||
>InferenceContext : InferenceContext
|
||||
|
||||
typeParameters: TypeParameter[];
|
||||
>typeParameters : TypeParameter[]
|
||||
>TypeParameter : TypeParameter
|
||||
|
||||
inferUnionTypes: boolean;
|
||||
>inferUnionTypes : boolean
|
||||
|
||||
inferences: TypeInferences[];
|
||||
>inferences : TypeInferences[]
|
||||
>TypeInferences : TypeInferences
|
||||
|
||||
inferredTypes: Type[];
|
||||
>inferredTypes : Type[]
|
||||
>Type : Type
|
||||
|
||||
failedTypeParameterIndex?: number;
|
||||
>failedTypeParameterIndex : number
|
||||
}
|
||||
interface DiagnosticMessage {
|
||||
>DiagnosticMessage : DiagnosticMessage
|
||||
@@ -4882,10 +4885,11 @@ declare module "typescript" {
|
||||
let version: string;
|
||||
>version : string
|
||||
|
||||
function createCompilerHost(options: CompilerOptions): CompilerHost;
|
||||
>createCompilerHost : (options: CompilerOptions) => CompilerHost
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
>createCompilerHost : (options: CompilerOptions, setParentNodes?: boolean) => CompilerHost
|
||||
>options : CompilerOptions
|
||||
>CompilerOptions : CompilerOptions
|
||||
>setParentNodes : boolean
|
||||
>CompilerHost : CompilerHost
|
||||
|
||||
function getPreEmitDiagnostics(program: Program): Diagnostic[];
|
||||
|
||||
@@ -586,6 +586,9 @@ declare module "typescript" {
|
||||
name?: Identifier;
|
||||
body: Block | Expression;
|
||||
}
|
||||
interface ArrowFunction extends Expression, FunctionLikeDeclaration {
|
||||
equalsGreaterThanToken: Node;
|
||||
}
|
||||
interface LiteralExpression extends PrimaryExpression {
|
||||
text: string;
|
||||
isUnterminated?: boolean;
|
||||
@@ -795,7 +798,8 @@ declare module "typescript" {
|
||||
type ExportSpecifier = ImportOrExportSpecifier;
|
||||
interface ExportAssignment extends Declaration, ModuleElement {
|
||||
isExportEquals?: boolean;
|
||||
expression: Expression;
|
||||
expression?: Expression;
|
||||
type?: TypeNode;
|
||||
}
|
||||
interface FileReference extends TextRange {
|
||||
fileName: string;
|
||||
@@ -830,14 +834,14 @@ declare module "typescript" {
|
||||
interface Program extends ScriptReferenceHost {
|
||||
getSourceFiles(): SourceFile[];
|
||||
/**
|
||||
* Emits the javascript and declaration files. If targetSourceFile is not specified, then
|
||||
* the javascript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the javascript and declaration for that
|
||||
* Emits the JavaScript and declaration files. If targetSourceFile is not specified, then
|
||||
* the JavaScript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the JavaScript and declaration for that
|
||||
* specific file will be generated.
|
||||
*
|
||||
* If writeFile is not specified then the writeFile callback from the compiler host will be
|
||||
* used for writing the javascript and declaration files. Otherwise, the writeFile parameter
|
||||
* will be invoked when writing the javascript and declaration files.
|
||||
* used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter
|
||||
* will be invoked when writing the JavaScript and declaration files.
|
||||
*/
|
||||
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult;
|
||||
getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
@@ -956,9 +960,10 @@ declare module "typescript" {
|
||||
NotAccessible = 1,
|
||||
CannotBeNamed = 2,
|
||||
}
|
||||
type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
interface SymbolVisibilityResult {
|
||||
accessibility: SymbolAccessibility;
|
||||
aliasesToMakeVisible?: ImportEqualsDeclaration[];
|
||||
aliasesToMakeVisible?: AnyImportSyntax[];
|
||||
errorSymbolName?: string;
|
||||
errorNode?: Node;
|
||||
}
|
||||
@@ -968,14 +973,16 @@ declare module "typescript" {
|
||||
interface EmitResolver {
|
||||
getGeneratedNameForNode(node: Node): string;
|
||||
getExpressionNameSubstitution(node: Identifier): string;
|
||||
isValueExportDeclaration(node: Node): boolean;
|
||||
isValueAliasDeclaration(node: Node): boolean;
|
||||
isReferencedAliasDeclaration(node: Node): boolean;
|
||||
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
|
||||
getNodeCheckFlags(node: Node): NodeCheckFlags;
|
||||
isDeclarationVisible(node: Declaration): boolean;
|
||||
collectLinkedAliases(node: Identifier): Node[];
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
@@ -1205,17 +1212,6 @@ declare module "typescript" {
|
||||
interface TypeMapper {
|
||||
(t: Type): Type;
|
||||
}
|
||||
interface TypeInferences {
|
||||
primary: Type[];
|
||||
secondary: Type[];
|
||||
}
|
||||
interface InferenceContext {
|
||||
typeParameters: TypeParameter[];
|
||||
inferUnionTypes: boolean;
|
||||
inferences: TypeInferences[];
|
||||
inferredTypes: Type[];
|
||||
failedTypeParameterIndex?: number;
|
||||
}
|
||||
interface DiagnosticMessage {
|
||||
key: string;
|
||||
category: DiagnosticCategory;
|
||||
@@ -1512,7 +1508,7 @@ declare module "typescript" {
|
||||
declare module "typescript" {
|
||||
/** The version of the TypeScript compiler release */
|
||||
let version: string;
|
||||
function createCompilerHost(options: CompilerOptions): CompilerHost;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
function getPreEmitDiagnostics(program: Program): Diagnostic[];
|
||||
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
|
||||
|
||||
@@ -1767,6 +1767,15 @@ declare module "typescript" {
|
||||
>body : Expression | Block
|
||||
>Block : Block
|
||||
>Expression : Expression
|
||||
}
|
||||
interface ArrowFunction extends Expression, FunctionLikeDeclaration {
|
||||
>ArrowFunction : ArrowFunction
|
||||
>Expression : Expression
|
||||
>FunctionLikeDeclaration : FunctionLikeDeclaration
|
||||
|
||||
equalsGreaterThanToken: Node;
|
||||
>equalsGreaterThanToken : Node
|
||||
>Node : Node
|
||||
}
|
||||
interface LiteralExpression extends PrimaryExpression {
|
||||
>LiteralExpression : LiteralExpression
|
||||
@@ -2423,9 +2432,13 @@ declare module "typescript" {
|
||||
isExportEquals?: boolean;
|
||||
>isExportEquals : boolean
|
||||
|
||||
expression: Expression;
|
||||
expression?: Expression;
|
||||
>expression : Expression
|
||||
>Expression : Expression
|
||||
|
||||
type?: TypeNode;
|
||||
>type : TypeNode
|
||||
>TypeNode : TypeNode
|
||||
}
|
||||
interface FileReference extends TextRange {
|
||||
>FileReference : FileReference
|
||||
@@ -2526,14 +2539,14 @@ declare module "typescript" {
|
||||
>SourceFile : SourceFile
|
||||
|
||||
/**
|
||||
* Emits the javascript and declaration files. If targetSourceFile is not specified, then
|
||||
* the javascript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the javascript and declaration for that
|
||||
* Emits the JavaScript and declaration files. If targetSourceFile is not specified, then
|
||||
* the JavaScript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the JavaScript and declaration for that
|
||||
* specific file will be generated.
|
||||
*
|
||||
* If writeFile is not specified then the writeFile callback from the compiler host will be
|
||||
* used for writing the javascript and declaration files. Otherwise, the writeFile parameter
|
||||
* will be invoked when writing the javascript and declaration files.
|
||||
* used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter
|
||||
* will be invoked when writing the JavaScript and declaration files.
|
||||
*/
|
||||
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult;
|
||||
>emit : (targetSourceFile?: SourceFile, writeFile?: WriteFileCallback) => EmitResult
|
||||
@@ -3056,6 +3069,11 @@ declare module "typescript" {
|
||||
CannotBeNamed = 2,
|
||||
>CannotBeNamed : SymbolAccessibility
|
||||
}
|
||||
type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
>AnyImportSyntax : ImportEqualsDeclaration | ImportDeclaration
|
||||
>ImportDeclaration : ImportDeclaration
|
||||
>ImportEqualsDeclaration : ImportEqualsDeclaration
|
||||
|
||||
interface SymbolVisibilityResult {
|
||||
>SymbolVisibilityResult : SymbolVisibilityResult
|
||||
|
||||
@@ -3063,9 +3081,9 @@ declare module "typescript" {
|
||||
>accessibility : SymbolAccessibility
|
||||
>SymbolAccessibility : SymbolAccessibility
|
||||
|
||||
aliasesToMakeVisible?: ImportEqualsDeclaration[];
|
||||
>aliasesToMakeVisible : ImportEqualsDeclaration[]
|
||||
>ImportEqualsDeclaration : ImportEqualsDeclaration
|
||||
aliasesToMakeVisible?: AnyImportSyntax[];
|
||||
>aliasesToMakeVisible : (ImportEqualsDeclaration | ImportDeclaration)[]
|
||||
>AnyImportSyntax : ImportEqualsDeclaration | ImportDeclaration
|
||||
|
||||
errorSymbolName?: string;
|
||||
>errorSymbolName : string
|
||||
@@ -3094,8 +3112,8 @@ declare module "typescript" {
|
||||
>node : Identifier
|
||||
>Identifier : Identifier
|
||||
|
||||
isValueExportDeclaration(node: Node): boolean;
|
||||
>isValueExportDeclaration : (node: Node) => boolean
|
||||
isValueAliasDeclaration(node: Node): boolean;
|
||||
>isValueAliasDeclaration : (node: Node) => boolean
|
||||
>node : Node
|
||||
>Node : Node
|
||||
|
||||
@@ -3120,6 +3138,12 @@ declare module "typescript" {
|
||||
>node : Declaration
|
||||
>Declaration : Declaration
|
||||
|
||||
collectLinkedAliases(node: Identifier): Node[];
|
||||
>collectLinkedAliases : (node: Identifier) => Node[]
|
||||
>node : Identifier
|
||||
>Identifier : Identifier
|
||||
>Node : Node
|
||||
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
>isImplementationOfOverload : (node: FunctionLikeDeclaration) => boolean
|
||||
>node : FunctionLikeDeclaration
|
||||
@@ -3146,6 +3170,17 @@ declare module "typescript" {
|
||||
>flags : TypeFormatFlags
|
||||
>TypeFormatFlags : TypeFormatFlags
|
||||
>writer : SymbolWriter
|
||||
>SymbolWriter : SymbolWriter
|
||||
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
>writeTypeOfExpression : (expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void
|
||||
>expr : Expression
|
||||
>Expression : Expression
|
||||
>enclosingDeclaration : Node
|
||||
>Node : Node
|
||||
>flags : TypeFormatFlags
|
||||
>TypeFormatFlags : TypeFormatFlags
|
||||
>writer : SymbolWriter
|
||||
>SymbolWriter : SymbolWriter
|
||||
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
@@ -3855,38 +3890,6 @@ declare module "typescript" {
|
||||
>t : Type
|
||||
>Type : Type
|
||||
>Type : Type
|
||||
}
|
||||
interface TypeInferences {
|
||||
>TypeInferences : TypeInferences
|
||||
|
||||
primary: Type[];
|
||||
>primary : Type[]
|
||||
>Type : Type
|
||||
|
||||
secondary: Type[];
|
||||
>secondary : Type[]
|
||||
>Type : Type
|
||||
}
|
||||
interface InferenceContext {
|
||||
>InferenceContext : InferenceContext
|
||||
|
||||
typeParameters: TypeParameter[];
|
||||
>typeParameters : TypeParameter[]
|
||||
>TypeParameter : TypeParameter
|
||||
|
||||
inferUnionTypes: boolean;
|
||||
>inferUnionTypes : boolean
|
||||
|
||||
inferences: TypeInferences[];
|
||||
>inferences : TypeInferences[]
|
||||
>TypeInferences : TypeInferences
|
||||
|
||||
inferredTypes: Type[];
|
||||
>inferredTypes : Type[]
|
||||
>Type : Type
|
||||
|
||||
failedTypeParameterIndex?: number;
|
||||
>failedTypeParameterIndex : number
|
||||
}
|
||||
interface DiagnosticMessage {
|
||||
>DiagnosticMessage : DiagnosticMessage
|
||||
@@ -4832,10 +4835,11 @@ declare module "typescript" {
|
||||
let version: string;
|
||||
>version : string
|
||||
|
||||
function createCompilerHost(options: CompilerOptions): CompilerHost;
|
||||
>createCompilerHost : (options: CompilerOptions) => CompilerHost
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
>createCompilerHost : (options: CompilerOptions, setParentNodes?: boolean) => CompilerHost
|
||||
>options : CompilerOptions
|
||||
>CompilerOptions : CompilerOptions
|
||||
>setParentNodes : boolean
|
||||
>CompilerHost : CompilerHost
|
||||
|
||||
function getPreEmitDiagnostics(program: Program): Diagnostic[];
|
||||
|
||||
@@ -623,6 +623,9 @@ declare module "typescript" {
|
||||
name?: Identifier;
|
||||
body: Block | Expression;
|
||||
}
|
||||
interface ArrowFunction extends Expression, FunctionLikeDeclaration {
|
||||
equalsGreaterThanToken: Node;
|
||||
}
|
||||
interface LiteralExpression extends PrimaryExpression {
|
||||
text: string;
|
||||
isUnterminated?: boolean;
|
||||
@@ -832,7 +835,8 @@ declare module "typescript" {
|
||||
type ExportSpecifier = ImportOrExportSpecifier;
|
||||
interface ExportAssignment extends Declaration, ModuleElement {
|
||||
isExportEquals?: boolean;
|
||||
expression: Expression;
|
||||
expression?: Expression;
|
||||
type?: TypeNode;
|
||||
}
|
||||
interface FileReference extends TextRange {
|
||||
fileName: string;
|
||||
@@ -867,14 +871,14 @@ declare module "typescript" {
|
||||
interface Program extends ScriptReferenceHost {
|
||||
getSourceFiles(): SourceFile[];
|
||||
/**
|
||||
* Emits the javascript and declaration files. If targetSourceFile is not specified, then
|
||||
* the javascript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the javascript and declaration for that
|
||||
* Emits the JavaScript and declaration files. If targetSourceFile is not specified, then
|
||||
* the JavaScript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the JavaScript and declaration for that
|
||||
* specific file will be generated.
|
||||
*
|
||||
* If writeFile is not specified then the writeFile callback from the compiler host will be
|
||||
* used for writing the javascript and declaration files. Otherwise, the writeFile parameter
|
||||
* will be invoked when writing the javascript and declaration files.
|
||||
* used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter
|
||||
* will be invoked when writing the JavaScript and declaration files.
|
||||
*/
|
||||
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult;
|
||||
getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
@@ -993,9 +997,10 @@ declare module "typescript" {
|
||||
NotAccessible = 1,
|
||||
CannotBeNamed = 2,
|
||||
}
|
||||
type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
interface SymbolVisibilityResult {
|
||||
accessibility: SymbolAccessibility;
|
||||
aliasesToMakeVisible?: ImportEqualsDeclaration[];
|
||||
aliasesToMakeVisible?: AnyImportSyntax[];
|
||||
errorSymbolName?: string;
|
||||
errorNode?: Node;
|
||||
}
|
||||
@@ -1005,14 +1010,16 @@ declare module "typescript" {
|
||||
interface EmitResolver {
|
||||
getGeneratedNameForNode(node: Node): string;
|
||||
getExpressionNameSubstitution(node: Identifier): string;
|
||||
isValueExportDeclaration(node: Node): boolean;
|
||||
isValueAliasDeclaration(node: Node): boolean;
|
||||
isReferencedAliasDeclaration(node: Node): boolean;
|
||||
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
|
||||
getNodeCheckFlags(node: Node): NodeCheckFlags;
|
||||
isDeclarationVisible(node: Declaration): boolean;
|
||||
collectLinkedAliases(node: Identifier): Node[];
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
@@ -1242,17 +1249,6 @@ declare module "typescript" {
|
||||
interface TypeMapper {
|
||||
(t: Type): Type;
|
||||
}
|
||||
interface TypeInferences {
|
||||
primary: Type[];
|
||||
secondary: Type[];
|
||||
}
|
||||
interface InferenceContext {
|
||||
typeParameters: TypeParameter[];
|
||||
inferUnionTypes: boolean;
|
||||
inferences: TypeInferences[];
|
||||
inferredTypes: Type[];
|
||||
failedTypeParameterIndex?: number;
|
||||
}
|
||||
interface DiagnosticMessage {
|
||||
key: string;
|
||||
category: DiagnosticCategory;
|
||||
@@ -1549,7 +1545,7 @@ declare module "typescript" {
|
||||
declare module "typescript" {
|
||||
/** The version of the TypeScript compiler release */
|
||||
let version: string;
|
||||
function createCompilerHost(options: CompilerOptions): CompilerHost;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
function getPreEmitDiagnostics(program: Program): Diagnostic[];
|
||||
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
|
||||
|
||||
@@ -1940,6 +1940,15 @@ declare module "typescript" {
|
||||
>body : Expression | Block
|
||||
>Block : Block
|
||||
>Expression : Expression
|
||||
}
|
||||
interface ArrowFunction extends Expression, FunctionLikeDeclaration {
|
||||
>ArrowFunction : ArrowFunction
|
||||
>Expression : Expression
|
||||
>FunctionLikeDeclaration : FunctionLikeDeclaration
|
||||
|
||||
equalsGreaterThanToken: Node;
|
||||
>equalsGreaterThanToken : Node
|
||||
>Node : Node
|
||||
}
|
||||
interface LiteralExpression extends PrimaryExpression {
|
||||
>LiteralExpression : LiteralExpression
|
||||
@@ -2596,9 +2605,13 @@ declare module "typescript" {
|
||||
isExportEquals?: boolean;
|
||||
>isExportEquals : boolean
|
||||
|
||||
expression: Expression;
|
||||
expression?: Expression;
|
||||
>expression : Expression
|
||||
>Expression : Expression
|
||||
|
||||
type?: TypeNode;
|
||||
>type : TypeNode
|
||||
>TypeNode : TypeNode
|
||||
}
|
||||
interface FileReference extends TextRange {
|
||||
>FileReference : FileReference
|
||||
@@ -2699,14 +2712,14 @@ declare module "typescript" {
|
||||
>SourceFile : SourceFile
|
||||
|
||||
/**
|
||||
* Emits the javascript and declaration files. If targetSourceFile is not specified, then
|
||||
* the javascript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the javascript and declaration for that
|
||||
* Emits the JavaScript and declaration files. If targetSourceFile is not specified, then
|
||||
* the JavaScript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the JavaScript and declaration for that
|
||||
* specific file will be generated.
|
||||
*
|
||||
* If writeFile is not specified then the writeFile callback from the compiler host will be
|
||||
* used for writing the javascript and declaration files. Otherwise, the writeFile parameter
|
||||
* will be invoked when writing the javascript and declaration files.
|
||||
* used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter
|
||||
* will be invoked when writing the JavaScript and declaration files.
|
||||
*/
|
||||
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult;
|
||||
>emit : (targetSourceFile?: SourceFile, writeFile?: WriteFileCallback) => EmitResult
|
||||
@@ -3229,6 +3242,11 @@ declare module "typescript" {
|
||||
CannotBeNamed = 2,
|
||||
>CannotBeNamed : SymbolAccessibility
|
||||
}
|
||||
type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
>AnyImportSyntax : ImportEqualsDeclaration | ImportDeclaration
|
||||
>ImportDeclaration : ImportDeclaration
|
||||
>ImportEqualsDeclaration : ImportEqualsDeclaration
|
||||
|
||||
interface SymbolVisibilityResult {
|
||||
>SymbolVisibilityResult : SymbolVisibilityResult
|
||||
|
||||
@@ -3236,9 +3254,9 @@ declare module "typescript" {
|
||||
>accessibility : SymbolAccessibility
|
||||
>SymbolAccessibility : SymbolAccessibility
|
||||
|
||||
aliasesToMakeVisible?: ImportEqualsDeclaration[];
|
||||
>aliasesToMakeVisible : ImportEqualsDeclaration[]
|
||||
>ImportEqualsDeclaration : ImportEqualsDeclaration
|
||||
aliasesToMakeVisible?: AnyImportSyntax[];
|
||||
>aliasesToMakeVisible : (ImportEqualsDeclaration | ImportDeclaration)[]
|
||||
>AnyImportSyntax : ImportEqualsDeclaration | ImportDeclaration
|
||||
|
||||
errorSymbolName?: string;
|
||||
>errorSymbolName : string
|
||||
@@ -3267,8 +3285,8 @@ declare module "typescript" {
|
||||
>node : Identifier
|
||||
>Identifier : Identifier
|
||||
|
||||
isValueExportDeclaration(node: Node): boolean;
|
||||
>isValueExportDeclaration : (node: Node) => boolean
|
||||
isValueAliasDeclaration(node: Node): boolean;
|
||||
>isValueAliasDeclaration : (node: Node) => boolean
|
||||
>node : Node
|
||||
>Node : Node
|
||||
|
||||
@@ -3293,6 +3311,12 @@ declare module "typescript" {
|
||||
>node : Declaration
|
||||
>Declaration : Declaration
|
||||
|
||||
collectLinkedAliases(node: Identifier): Node[];
|
||||
>collectLinkedAliases : (node: Identifier) => Node[]
|
||||
>node : Identifier
|
||||
>Identifier : Identifier
|
||||
>Node : Node
|
||||
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
>isImplementationOfOverload : (node: FunctionLikeDeclaration) => boolean
|
||||
>node : FunctionLikeDeclaration
|
||||
@@ -3319,6 +3343,17 @@ declare module "typescript" {
|
||||
>flags : TypeFormatFlags
|
||||
>TypeFormatFlags : TypeFormatFlags
|
||||
>writer : SymbolWriter
|
||||
>SymbolWriter : SymbolWriter
|
||||
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
>writeTypeOfExpression : (expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void
|
||||
>expr : Expression
|
||||
>Expression : Expression
|
||||
>enclosingDeclaration : Node
|
||||
>Node : Node
|
||||
>flags : TypeFormatFlags
|
||||
>TypeFormatFlags : TypeFormatFlags
|
||||
>writer : SymbolWriter
|
||||
>SymbolWriter : SymbolWriter
|
||||
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
@@ -4028,38 +4063,6 @@ declare module "typescript" {
|
||||
>t : Type
|
||||
>Type : Type
|
||||
>Type : Type
|
||||
}
|
||||
interface TypeInferences {
|
||||
>TypeInferences : TypeInferences
|
||||
|
||||
primary: Type[];
|
||||
>primary : Type[]
|
||||
>Type : Type
|
||||
|
||||
secondary: Type[];
|
||||
>secondary : Type[]
|
||||
>Type : Type
|
||||
}
|
||||
interface InferenceContext {
|
||||
>InferenceContext : InferenceContext
|
||||
|
||||
typeParameters: TypeParameter[];
|
||||
>typeParameters : TypeParameter[]
|
||||
>TypeParameter : TypeParameter
|
||||
|
||||
inferUnionTypes: boolean;
|
||||
>inferUnionTypes : boolean
|
||||
|
||||
inferences: TypeInferences[];
|
||||
>inferences : TypeInferences[]
|
||||
>TypeInferences : TypeInferences
|
||||
|
||||
inferredTypes: Type[];
|
||||
>inferredTypes : Type[]
|
||||
>Type : Type
|
||||
|
||||
failedTypeParameterIndex?: number;
|
||||
>failedTypeParameterIndex : number
|
||||
}
|
||||
interface DiagnosticMessage {
|
||||
>DiagnosticMessage : DiagnosticMessage
|
||||
@@ -5005,10 +5008,11 @@ declare module "typescript" {
|
||||
let version: string;
|
||||
>version : string
|
||||
|
||||
function createCompilerHost(options: CompilerOptions): CompilerHost;
|
||||
>createCompilerHost : (options: CompilerOptions) => CompilerHost
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
>createCompilerHost : (options: CompilerOptions, setParentNodes?: boolean) => CompilerHost
|
||||
>options : CompilerOptions
|
||||
>CompilerOptions : CompilerOptions
|
||||
>setParentNodes : boolean
|
||||
>CompilerHost : CompilerHost
|
||||
|
||||
function getPreEmitDiagnostics(program: Program): Diagnostic[];
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts(1,15): error TS2461: Type 'StringIterator' is not an array type or a string type.
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts(1,15): error TS2495: Type 'StringIterator' is not an array type or a string type.
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts(11,6): error TS2304: Cannot find name 'Symbol'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts (2 errors) ====
|
||||
for (var v of new StringIterator) { }
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2461: Type 'StringIterator' is not an array type or a string type.
|
||||
!!! error TS2495: Type 'StringIterator' is not an array type or a string type.
|
||||
|
||||
// In ES3/5, you cannot for...of over an arbitrary iterable.
|
||||
class StringIterator {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck12.ts(1,17): error TS2461: Type 'number' is not an array type or a string type.
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck12.ts(1,17): error TS2495: Type 'number' is not an array type or a string type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck12.ts (1 errors) ====
|
||||
for (const v of 0) { }
|
||||
~
|
||||
!!! error TS2461: Type 'number' is not an array type or a string type.
|
||||
!!! error TS2495: Type 'number' is not an array type or a string type.
|
||||
@@ -34,6 +34,6 @@ var enumdule;
|
||||
enumdule.Point = Point;
|
||||
})(enumdule || (enumdule = {}));
|
||||
var x;
|
||||
var x = 0 /* Red */;
|
||||
var x = enumdule.Red;
|
||||
var y;
|
||||
var y = new enumdule.Point(0, 0);
|
||||
|
||||
@@ -34,6 +34,6 @@ var enumdule;
|
||||
enumdule[enumdule["Blue"] = 1] = "Blue";
|
||||
})(enumdule || (enumdule = {}));
|
||||
var x;
|
||||
var x = 0 /* Red */;
|
||||
var x = enumdule.Red;
|
||||
var y;
|
||||
var y = new enumdule.Point(0, 0);
|
||||
|
||||
@@ -26,6 +26,6 @@ var A;
|
||||
})(Day || (Day = {}));
|
||||
})(A || (A = {}));
|
||||
// not an error since exported
|
||||
var a = 0 /* Red */;
|
||||
var a = A.Color.Red;
|
||||
// error not exported
|
||||
var b = A.Day.Monday;
|
||||
|
||||
@@ -81,7 +81,7 @@ var r11 = a + foo();
|
||||
var r12 = a + C;
|
||||
var r13 = a + new C();
|
||||
var r14 = a + E;
|
||||
var r15 = a + 0 /* a */;
|
||||
var r15 = a + E.a;
|
||||
var r16 = a + M;
|
||||
var r17 = a + '';
|
||||
var r18 = a + 123;
|
||||
|
||||
@@ -85,6 +85,6 @@ var r14 = b + d;
|
||||
var r15 = b + foo;
|
||||
var r16 = b + foo();
|
||||
var r17 = b + C;
|
||||
var r18 = 0 /* a */ + new C();
|
||||
var r19 = 0 /* a */ + C.foo();
|
||||
var r20 = 0 /* a */ + M;
|
||||
var r18 = E.a + new C();
|
||||
var r19 = E.a + C.foo();
|
||||
var r20 = E.a + M;
|
||||
|
||||
@@ -49,13 +49,13 @@ var r2 = a + null;
|
||||
var r3 = null + b;
|
||||
var r4 = null + 1;
|
||||
var r5 = null + c;
|
||||
var r6 = null + 0 /* a */;
|
||||
var r7 = null + 0 /* 'a' */;
|
||||
var r6 = null + E.a;
|
||||
var r7 = null + E['a'];
|
||||
var r8 = b + null;
|
||||
var r9 = 1 + null;
|
||||
var r10 = c + null;
|
||||
var r11 = 0 /* a */ + null;
|
||||
var r12 = 0 /* 'a' */ + null;
|
||||
var r11 = E.a + null;
|
||||
var r12 = E['a'] + null;
|
||||
// null + string
|
||||
var r13 = null + d;
|
||||
var r14 = null + '';
|
||||
|
||||
@@ -43,10 +43,10 @@ var r2 = a + b;
|
||||
var r3 = b + a;
|
||||
var r4 = b + b;
|
||||
var r5 = 0 + a;
|
||||
var r6 = 0 /* a */ + 0;
|
||||
var r7 = 0 /* a */ + 1 /* b */;
|
||||
var r8 = 0 /* 'a' */ + 1 /* 'b' */;
|
||||
var r9 = 0 /* 'a' */ + 0 /* 'c' */;
|
||||
var r6 = E.a + 0;
|
||||
var r7 = E.a + E.b;
|
||||
var r8 = E['a'] + E['b'];
|
||||
var r9 = E['a'] + F['c'];
|
||||
var r10 = a + c;
|
||||
var r11 = c + a;
|
||||
var r12 = b + c;
|
||||
|
||||
@@ -72,7 +72,7 @@ var r13 = f + x;
|
||||
var r14 = g + x;
|
||||
// other cases
|
||||
var r15 = x + E;
|
||||
var r16 = x + 0 /* a */;
|
||||
var r16 = x + E.a;
|
||||
var r17 = x + '';
|
||||
var r18 = x + 0;
|
||||
var r19 = x + {
|
||||
|
||||
@@ -49,13 +49,13 @@ var r2 = a + undefined;
|
||||
var r3 = undefined + b;
|
||||
var r4 = undefined + 1;
|
||||
var r5 = undefined + c;
|
||||
var r6 = undefined + 0 /* a */;
|
||||
var r7 = undefined + 0 /* 'a' */;
|
||||
var r6 = undefined + E.a;
|
||||
var r7 = undefined + E['a'];
|
||||
var r8 = b + undefined;
|
||||
var r9 = 1 + undefined;
|
||||
var r10 = c + undefined;
|
||||
var r11 = 0 /* a */ + undefined;
|
||||
var r12 = 0 /* 'a' */ + undefined;
|
||||
var r11 = E.a + undefined;
|
||||
var r12 = E['a'] + undefined;
|
||||
// undefined + string
|
||||
var r13 = undefined + d;
|
||||
var r14 = undefined + '';
|
||||
|
||||
@@ -23,6 +23,6 @@ define(["require", "exports"], function (require, exports) {
|
||||
});
|
||||
//// [foo_1.js]
|
||||
define(["require", "exports", "./foo_0"], function (require, exports, foo) {
|
||||
if (0 /* A */ === 0) {
|
||||
if (foo.E1.A === 0) {
|
||||
}
|
||||
});
|
||||
|
||||
@@ -166,127 +166,127 @@ var ra2 = c * b;
|
||||
var ra3 = c * c;
|
||||
var ra4 = a * c;
|
||||
var ra5 = b * c;
|
||||
var ra6 = 0 /* a */ * a;
|
||||
var ra7 = 0 /* a */ * b;
|
||||
var ra8 = 0 /* a */ * 1 /* b */;
|
||||
var ra9 = 0 /* a */ * 1;
|
||||
var ra10 = a * 1 /* b */;
|
||||
var ra11 = b * 1 /* b */;
|
||||
var ra12 = 1 * 1 /* b */;
|
||||
var ra6 = E.a * a;
|
||||
var ra7 = E.a * b;
|
||||
var ra8 = E.a * E.b;
|
||||
var ra9 = E.a * 1;
|
||||
var ra10 = a * E.b;
|
||||
var ra11 = b * E.b;
|
||||
var ra12 = 1 * E.b;
|
||||
// operator /
|
||||
var rb1 = c / a;
|
||||
var rb2 = c / b;
|
||||
var rb3 = c / c;
|
||||
var rb4 = a / c;
|
||||
var rb5 = b / c;
|
||||
var rb6 = 0 /* a */ / a;
|
||||
var rb7 = 0 /* a */ / b;
|
||||
var rb8 = 0 /* a */ / 1 /* b */;
|
||||
var rb9 = 0 /* a */ / 1;
|
||||
var rb10 = a / 1 /* b */;
|
||||
var rb11 = b / 1 /* b */;
|
||||
var rb12 = 1 / 1 /* b */;
|
||||
var rb6 = E.a / a;
|
||||
var rb7 = E.a / b;
|
||||
var rb8 = E.a / E.b;
|
||||
var rb9 = E.a / 1;
|
||||
var rb10 = a / E.b;
|
||||
var rb11 = b / E.b;
|
||||
var rb12 = 1 / E.b;
|
||||
// operator %
|
||||
var rc1 = c % a;
|
||||
var rc2 = c % b;
|
||||
var rc3 = c % c;
|
||||
var rc4 = a % c;
|
||||
var rc5 = b % c;
|
||||
var rc6 = 0 /* a */ % a;
|
||||
var rc7 = 0 /* a */ % b;
|
||||
var rc8 = 0 /* a */ % 1 /* b */;
|
||||
var rc9 = 0 /* a */ % 1;
|
||||
var rc10 = a % 1 /* b */;
|
||||
var rc11 = b % 1 /* b */;
|
||||
var rc12 = 1 % 1 /* b */;
|
||||
var rc6 = E.a % a;
|
||||
var rc7 = E.a % b;
|
||||
var rc8 = E.a % E.b;
|
||||
var rc9 = E.a % 1;
|
||||
var rc10 = a % E.b;
|
||||
var rc11 = b % E.b;
|
||||
var rc12 = 1 % E.b;
|
||||
// operator -
|
||||
var rd1 = c - a;
|
||||
var rd2 = c - b;
|
||||
var rd3 = c - c;
|
||||
var rd4 = a - c;
|
||||
var rd5 = b - c;
|
||||
var rd6 = 0 /* a */ - a;
|
||||
var rd7 = 0 /* a */ - b;
|
||||
var rd8 = 0 /* a */ - 1 /* b */;
|
||||
var rd9 = 0 /* a */ - 1;
|
||||
var rd10 = a - 1 /* b */;
|
||||
var rd11 = b - 1 /* b */;
|
||||
var rd12 = 1 - 1 /* b */;
|
||||
var rd6 = E.a - a;
|
||||
var rd7 = E.a - b;
|
||||
var rd8 = E.a - E.b;
|
||||
var rd9 = E.a - 1;
|
||||
var rd10 = a - E.b;
|
||||
var rd11 = b - E.b;
|
||||
var rd12 = 1 - E.b;
|
||||
// operator <<
|
||||
var re1 = c << a;
|
||||
var re2 = c << b;
|
||||
var re3 = c << c;
|
||||
var re4 = a << c;
|
||||
var re5 = b << c;
|
||||
var re6 = 0 /* a */ << a;
|
||||
var re7 = 0 /* a */ << b;
|
||||
var re8 = 0 /* a */ << 1 /* b */;
|
||||
var re9 = 0 /* a */ << 1;
|
||||
var re10 = a << 1 /* b */;
|
||||
var re11 = b << 1 /* b */;
|
||||
var re12 = 1 << 1 /* b */;
|
||||
var re6 = E.a << a;
|
||||
var re7 = E.a << b;
|
||||
var re8 = E.a << E.b;
|
||||
var re9 = E.a << 1;
|
||||
var re10 = a << E.b;
|
||||
var re11 = b << E.b;
|
||||
var re12 = 1 << E.b;
|
||||
// operator >>
|
||||
var rf1 = c >> a;
|
||||
var rf2 = c >> b;
|
||||
var rf3 = c >> c;
|
||||
var rf4 = a >> c;
|
||||
var rf5 = b >> c;
|
||||
var rf6 = 0 /* a */ >> a;
|
||||
var rf7 = 0 /* a */ >> b;
|
||||
var rf8 = 0 /* a */ >> 1 /* b */;
|
||||
var rf9 = 0 /* a */ >> 1;
|
||||
var rf10 = a >> 1 /* b */;
|
||||
var rf11 = b >> 1 /* b */;
|
||||
var rf12 = 1 >> 1 /* b */;
|
||||
var rf6 = E.a >> a;
|
||||
var rf7 = E.a >> b;
|
||||
var rf8 = E.a >> E.b;
|
||||
var rf9 = E.a >> 1;
|
||||
var rf10 = a >> E.b;
|
||||
var rf11 = b >> E.b;
|
||||
var rf12 = 1 >> E.b;
|
||||
// operator >>>
|
||||
var rg1 = c >>> a;
|
||||
var rg2 = c >>> b;
|
||||
var rg3 = c >>> c;
|
||||
var rg4 = a >>> c;
|
||||
var rg5 = b >>> c;
|
||||
var rg6 = 0 /* a */ >>> a;
|
||||
var rg7 = 0 /* a */ >>> b;
|
||||
var rg8 = 0 /* a */ >>> 1 /* b */;
|
||||
var rg9 = 0 /* a */ >>> 1;
|
||||
var rg10 = a >>> 1 /* b */;
|
||||
var rg11 = b >>> 1 /* b */;
|
||||
var rg12 = 1 >>> 1 /* b */;
|
||||
var rg6 = E.a >>> a;
|
||||
var rg7 = E.a >>> b;
|
||||
var rg8 = E.a >>> E.b;
|
||||
var rg9 = E.a >>> 1;
|
||||
var rg10 = a >>> E.b;
|
||||
var rg11 = b >>> E.b;
|
||||
var rg12 = 1 >>> E.b;
|
||||
// operator &
|
||||
var rh1 = c & a;
|
||||
var rh2 = c & b;
|
||||
var rh3 = c & c;
|
||||
var rh4 = a & c;
|
||||
var rh5 = b & c;
|
||||
var rh6 = 0 /* a */ & a;
|
||||
var rh7 = 0 /* a */ & b;
|
||||
var rh8 = 0 /* a */ & 1 /* b */;
|
||||
var rh9 = 0 /* a */ & 1;
|
||||
var rh10 = a & 1 /* b */;
|
||||
var rh11 = b & 1 /* b */;
|
||||
var rh12 = 1 & 1 /* b */;
|
||||
var rh6 = E.a & a;
|
||||
var rh7 = E.a & b;
|
||||
var rh8 = E.a & E.b;
|
||||
var rh9 = E.a & 1;
|
||||
var rh10 = a & E.b;
|
||||
var rh11 = b & E.b;
|
||||
var rh12 = 1 & E.b;
|
||||
// operator ^
|
||||
var ri1 = c ^ a;
|
||||
var ri2 = c ^ b;
|
||||
var ri3 = c ^ c;
|
||||
var ri4 = a ^ c;
|
||||
var ri5 = b ^ c;
|
||||
var ri6 = 0 /* a */ ^ a;
|
||||
var ri7 = 0 /* a */ ^ b;
|
||||
var ri8 = 0 /* a */ ^ 1 /* b */;
|
||||
var ri9 = 0 /* a */ ^ 1;
|
||||
var ri10 = a ^ 1 /* b */;
|
||||
var ri11 = b ^ 1 /* b */;
|
||||
var ri12 = 1 ^ 1 /* b */;
|
||||
var ri6 = E.a ^ a;
|
||||
var ri7 = E.a ^ b;
|
||||
var ri8 = E.a ^ E.b;
|
||||
var ri9 = E.a ^ 1;
|
||||
var ri10 = a ^ E.b;
|
||||
var ri11 = b ^ E.b;
|
||||
var ri12 = 1 ^ E.b;
|
||||
// operator |
|
||||
var rj1 = c | a;
|
||||
var rj2 = c | b;
|
||||
var rj3 = c | c;
|
||||
var rj4 = a | c;
|
||||
var rj5 = b | c;
|
||||
var rj6 = 0 /* a */ | a;
|
||||
var rj7 = 0 /* a */ | b;
|
||||
var rj8 = 0 /* a */ | 1 /* b */;
|
||||
var rj9 = 0 /* a */ | 1;
|
||||
var rj10 = a | 1 /* b */;
|
||||
var rj11 = b | 1 /* b */;
|
||||
var rj12 = 1 | 1 /* b */;
|
||||
var rj6 = E.a | a;
|
||||
var rj7 = E.a | b;
|
||||
var rj8 = E.a | E.b;
|
||||
var rj9 = E.a | 1;
|
||||
var rj10 = a | E.b;
|
||||
var rj11 = b | E.b;
|
||||
var rj12 = 1 | E.b;
|
||||
|
||||
@@ -175,127 +175,127 @@ var ra2 = c * b;
|
||||
var ra3 = c * c;
|
||||
var ra4 = a * c;
|
||||
var ra5 = b * c;
|
||||
var ra6 = 0 /* a */ * a;
|
||||
var ra7 = 0 /* a */ * b;
|
||||
var ra8 = 0 /* a */ * 1 /* b */;
|
||||
var ra9 = 0 /* a */ * 1;
|
||||
var ra10 = a * 1 /* b */;
|
||||
var ra11 = b * 1 /* b */;
|
||||
var ra12 = 1 * 1 /* b */;
|
||||
var ra6 = E.a * a;
|
||||
var ra7 = E.a * b;
|
||||
var ra8 = E.a * E.b;
|
||||
var ra9 = E.a * 1;
|
||||
var ra10 = a * E.b;
|
||||
var ra11 = b * E.b;
|
||||
var ra12 = 1 * E.b;
|
||||
// operator /
|
||||
var rb1 = c / a;
|
||||
var rb2 = c / b;
|
||||
var rb3 = c / c;
|
||||
var rb4 = a / c;
|
||||
var rb5 = b / c;
|
||||
var rb6 = 0 /* a */ / a;
|
||||
var rb7 = 0 /* a */ / b;
|
||||
var rb8 = 0 /* a */ / 1 /* b */;
|
||||
var rb9 = 0 /* a */ / 1;
|
||||
var rb10 = a / 1 /* b */;
|
||||
var rb11 = b / 1 /* b */;
|
||||
var rb12 = 1 / 1 /* b */;
|
||||
var rb6 = E.a / a;
|
||||
var rb7 = E.a / b;
|
||||
var rb8 = E.a / E.b;
|
||||
var rb9 = E.a / 1;
|
||||
var rb10 = a / E.b;
|
||||
var rb11 = b / E.b;
|
||||
var rb12 = 1 / E.b;
|
||||
// operator %
|
||||
var rc1 = c % a;
|
||||
var rc2 = c % b;
|
||||
var rc3 = c % c;
|
||||
var rc4 = a % c;
|
||||
var rc5 = b % c;
|
||||
var rc6 = 0 /* a */ % a;
|
||||
var rc7 = 0 /* a */ % b;
|
||||
var rc8 = 0 /* a */ % 1 /* b */;
|
||||
var rc9 = 0 /* a */ % 1;
|
||||
var rc10 = a % 1 /* b */;
|
||||
var rc11 = b % 1 /* b */;
|
||||
var rc12 = 1 % 1 /* b */;
|
||||
var rc6 = E.a % a;
|
||||
var rc7 = E.a % b;
|
||||
var rc8 = E.a % E.b;
|
||||
var rc9 = E.a % 1;
|
||||
var rc10 = a % E.b;
|
||||
var rc11 = b % E.b;
|
||||
var rc12 = 1 % E.b;
|
||||
// operator -
|
||||
var rd1 = c - a;
|
||||
var rd2 = c - b;
|
||||
var rd3 = c - c;
|
||||
var rd4 = a - c;
|
||||
var rd5 = b - c;
|
||||
var rd6 = 0 /* a */ - a;
|
||||
var rd7 = 0 /* a */ - b;
|
||||
var rd8 = 0 /* a */ - 1 /* b */;
|
||||
var rd9 = 0 /* a */ - 1;
|
||||
var rd10 = a - 1 /* b */;
|
||||
var rd11 = b - 1 /* b */;
|
||||
var rd12 = 1 - 1 /* b */;
|
||||
var rd6 = E.a - a;
|
||||
var rd7 = E.a - b;
|
||||
var rd8 = E.a - E.b;
|
||||
var rd9 = E.a - 1;
|
||||
var rd10 = a - E.b;
|
||||
var rd11 = b - E.b;
|
||||
var rd12 = 1 - E.b;
|
||||
// operator <<
|
||||
var re1 = c << a;
|
||||
var re2 = c << b;
|
||||
var re3 = c << c;
|
||||
var re4 = a << c;
|
||||
var re5 = b << c;
|
||||
var re6 = 0 /* a */ << a;
|
||||
var re7 = 0 /* a */ << b;
|
||||
var re8 = 0 /* a */ << 1 /* b */;
|
||||
var re9 = 0 /* a */ << 1;
|
||||
var re10 = a << 1 /* b */;
|
||||
var re11 = b << 1 /* b */;
|
||||
var re12 = 1 << 1 /* b */;
|
||||
var re6 = E.a << a;
|
||||
var re7 = E.a << b;
|
||||
var re8 = E.a << E.b;
|
||||
var re9 = E.a << 1;
|
||||
var re10 = a << E.b;
|
||||
var re11 = b << E.b;
|
||||
var re12 = 1 << E.b;
|
||||
// operator >>
|
||||
var rf1 = c >> a;
|
||||
var rf2 = c >> b;
|
||||
var rf3 = c >> c;
|
||||
var rf4 = a >> c;
|
||||
var rf5 = b >> c;
|
||||
var rf6 = 0 /* a */ >> a;
|
||||
var rf7 = 0 /* a */ >> b;
|
||||
var rf8 = 0 /* a */ >> 1 /* b */;
|
||||
var rf9 = 0 /* a */ >> 1;
|
||||
var rf10 = a >> 1 /* b */;
|
||||
var rf11 = b >> 1 /* b */;
|
||||
var rf12 = 1 >> 1 /* b */;
|
||||
var rf6 = E.a >> a;
|
||||
var rf7 = E.a >> b;
|
||||
var rf8 = E.a >> E.b;
|
||||
var rf9 = E.a >> 1;
|
||||
var rf10 = a >> E.b;
|
||||
var rf11 = b >> E.b;
|
||||
var rf12 = 1 >> E.b;
|
||||
// operator >>>
|
||||
var rg1 = c >>> a;
|
||||
var rg2 = c >>> b;
|
||||
var rg3 = c >>> c;
|
||||
var rg4 = a >>> c;
|
||||
var rg5 = b >>> c;
|
||||
var rg6 = 0 /* a */ >>> a;
|
||||
var rg7 = 0 /* a */ >>> b;
|
||||
var rg8 = 0 /* a */ >>> 1 /* b */;
|
||||
var rg9 = 0 /* a */ >>> 1;
|
||||
var rg10 = a >>> 1 /* b */;
|
||||
var rg11 = b >>> 1 /* b */;
|
||||
var rg12 = 1 >>> 1 /* b */;
|
||||
var rg6 = E.a >>> a;
|
||||
var rg7 = E.a >>> b;
|
||||
var rg8 = E.a >>> E.b;
|
||||
var rg9 = E.a >>> 1;
|
||||
var rg10 = a >>> E.b;
|
||||
var rg11 = b >>> E.b;
|
||||
var rg12 = 1 >>> E.b;
|
||||
// operator &
|
||||
var rh1 = c & a;
|
||||
var rh2 = c & b;
|
||||
var rh3 = c & c;
|
||||
var rh4 = a & c;
|
||||
var rh5 = b & c;
|
||||
var rh6 = 0 /* a */ & a;
|
||||
var rh7 = 0 /* a */ & b;
|
||||
var rh8 = 0 /* a */ & 1 /* b */;
|
||||
var rh9 = 0 /* a */ & 1;
|
||||
var rh10 = a & 1 /* b */;
|
||||
var rh11 = b & 1 /* b */;
|
||||
var rh12 = 1 & 1 /* b */;
|
||||
var rh6 = E.a & a;
|
||||
var rh7 = E.a & b;
|
||||
var rh8 = E.a & E.b;
|
||||
var rh9 = E.a & 1;
|
||||
var rh10 = a & E.b;
|
||||
var rh11 = b & E.b;
|
||||
var rh12 = 1 & E.b;
|
||||
// operator ^
|
||||
var ri1 = c ^ a;
|
||||
var ri2 = c ^ b;
|
||||
var ri3 = c ^ c;
|
||||
var ri4 = a ^ c;
|
||||
var ri5 = b ^ c;
|
||||
var ri6 = 0 /* a */ ^ a;
|
||||
var ri7 = 0 /* a */ ^ b;
|
||||
var ri8 = 0 /* a */ ^ 1 /* b */;
|
||||
var ri9 = 0 /* a */ ^ 1;
|
||||
var ri10 = a ^ 1 /* b */;
|
||||
var ri11 = b ^ 1 /* b */;
|
||||
var ri12 = 1 ^ 1 /* b */;
|
||||
var ri6 = E.a ^ a;
|
||||
var ri7 = E.a ^ b;
|
||||
var ri8 = E.a ^ E.b;
|
||||
var ri9 = E.a ^ 1;
|
||||
var ri10 = a ^ E.b;
|
||||
var ri11 = b ^ E.b;
|
||||
var ri12 = 1 ^ E.b;
|
||||
// operator |
|
||||
var rj1 = c | a;
|
||||
var rj2 = c | b;
|
||||
var rj3 = c | c;
|
||||
var rj4 = a | c;
|
||||
var rj5 = b | c;
|
||||
var rj6 = 0 /* a */ | a;
|
||||
var rj7 = 0 /* a */ | b;
|
||||
var rj8 = 0 /* a */ | 1 /* b */;
|
||||
var rj9 = 0 /* a */ | 1;
|
||||
var rj10 = a | 1 /* b */;
|
||||
var rj11 = b | 1 /* b */;
|
||||
var rj12 = 1 | 1 /* b */;
|
||||
var rj6 = E.a | a;
|
||||
var rj7 = E.a | b;
|
||||
var rj8 = E.a | E.b;
|
||||
var rj9 = E.a | 1;
|
||||
var rj10 = a | E.b;
|
||||
var rj11 = b | E.b;
|
||||
var rj12 = 1 | E.b;
|
||||
|
||||
@@ -634,18 +634,18 @@ var r1f3 = f * c;
|
||||
var r1f4 = f * d;
|
||||
var r1f5 = f * e;
|
||||
var r1f6 = f * f;
|
||||
var r1g1 = 0 /* a */ * a; //ok
|
||||
var r1g2 = 0 /* a */ * b;
|
||||
var r1g3 = 0 /* a */ * c; //ok
|
||||
var r1g4 = 0 /* a */ * d;
|
||||
var r1g5 = 0 /* a */ * e;
|
||||
var r1g6 = 0 /* a */ * f;
|
||||
var r1h1 = a * 1 /* b */; //ok
|
||||
var r1h2 = b * 1 /* b */;
|
||||
var r1h3 = c * 1 /* b */; //ok
|
||||
var r1h4 = d * 1 /* b */;
|
||||
var r1h5 = e * 1 /* b */;
|
||||
var r1h6 = f * 1 /* b */;
|
||||
var r1g1 = E.a * a; //ok
|
||||
var r1g2 = E.a * b;
|
||||
var r1g3 = E.a * c; //ok
|
||||
var r1g4 = E.a * d;
|
||||
var r1g5 = E.a * e;
|
||||
var r1g6 = E.a * f;
|
||||
var r1h1 = a * E.b; //ok
|
||||
var r1h2 = b * E.b;
|
||||
var r1h3 = c * E.b; //ok
|
||||
var r1h4 = d * E.b;
|
||||
var r1h5 = e * E.b;
|
||||
var r1h6 = f * E.b;
|
||||
// operator /
|
||||
var r2a1 = a / a; //ok
|
||||
var r2a2 = a / b;
|
||||
@@ -683,18 +683,18 @@ var r2f3 = f / c;
|
||||
var r2f4 = f / d;
|
||||
var r2f5 = f / e;
|
||||
var r2f6 = f / f;
|
||||
var r2g1 = 0 /* a */ / a; //ok
|
||||
var r2g2 = 0 /* a */ / b;
|
||||
var r2g3 = 0 /* a */ / c; //ok
|
||||
var r2g4 = 0 /* a */ / d;
|
||||
var r2g5 = 0 /* a */ / e;
|
||||
var r2g6 = 0 /* a */ / f;
|
||||
var r2h1 = a / 1 /* b */; //ok
|
||||
var r2h2 = b / 1 /* b */;
|
||||
var r2h3 = c / 1 /* b */; //ok
|
||||
var r2h4 = d / 1 /* b */;
|
||||
var r2h5 = e / 1 /* b */;
|
||||
var r2h6 = f / 1 /* b */;
|
||||
var r2g1 = E.a / a; //ok
|
||||
var r2g2 = E.a / b;
|
||||
var r2g3 = E.a / c; //ok
|
||||
var r2g4 = E.a / d;
|
||||
var r2g5 = E.a / e;
|
||||
var r2g6 = E.a / f;
|
||||
var r2h1 = a / E.b; //ok
|
||||
var r2h2 = b / E.b;
|
||||
var r2h3 = c / E.b; //ok
|
||||
var r2h4 = d / E.b;
|
||||
var r2h5 = e / E.b;
|
||||
var r2h6 = f / E.b;
|
||||
// operator %
|
||||
var r3a1 = a % a; //ok
|
||||
var r3a2 = a % b;
|
||||
@@ -732,18 +732,18 @@ var r3f3 = f % c;
|
||||
var r3f4 = f % d;
|
||||
var r3f5 = f % e;
|
||||
var r3f6 = f % f;
|
||||
var r3g1 = 0 /* a */ % a; //ok
|
||||
var r3g2 = 0 /* a */ % b;
|
||||
var r3g3 = 0 /* a */ % c; //ok
|
||||
var r3g4 = 0 /* a */ % d;
|
||||
var r3g5 = 0 /* a */ % e;
|
||||
var r3g6 = 0 /* a */ % f;
|
||||
var r3h1 = a % 1 /* b */; //ok
|
||||
var r3h2 = b % 1 /* b */;
|
||||
var r3h3 = c % 1 /* b */; //ok
|
||||
var r3h4 = d % 1 /* b */;
|
||||
var r3h5 = e % 1 /* b */;
|
||||
var r3h6 = f % 1 /* b */;
|
||||
var r3g1 = E.a % a; //ok
|
||||
var r3g2 = E.a % b;
|
||||
var r3g3 = E.a % c; //ok
|
||||
var r3g4 = E.a % d;
|
||||
var r3g5 = E.a % e;
|
||||
var r3g6 = E.a % f;
|
||||
var r3h1 = a % E.b; //ok
|
||||
var r3h2 = b % E.b;
|
||||
var r3h3 = c % E.b; //ok
|
||||
var r3h4 = d % E.b;
|
||||
var r3h5 = e % E.b;
|
||||
var r3h6 = f % E.b;
|
||||
// operator -
|
||||
var r4a1 = a - a; //ok
|
||||
var r4a2 = a - b;
|
||||
@@ -781,18 +781,18 @@ var r4f3 = f - c;
|
||||
var r4f4 = f - d;
|
||||
var r4f5 = f - e;
|
||||
var r4f6 = f - f;
|
||||
var r4g1 = 0 /* a */ - a; //ok
|
||||
var r4g2 = 0 /* a */ - b;
|
||||
var r4g3 = 0 /* a */ - c; //ok
|
||||
var r4g4 = 0 /* a */ - d;
|
||||
var r4g5 = 0 /* a */ - e;
|
||||
var r4g6 = 0 /* a */ - f;
|
||||
var r4h1 = a - 1 /* b */; //ok
|
||||
var r4h2 = b - 1 /* b */;
|
||||
var r4h3 = c - 1 /* b */; //ok
|
||||
var r4h4 = d - 1 /* b */;
|
||||
var r4h5 = e - 1 /* b */;
|
||||
var r4h6 = f - 1 /* b */;
|
||||
var r4g1 = E.a - a; //ok
|
||||
var r4g2 = E.a - b;
|
||||
var r4g3 = E.a - c; //ok
|
||||
var r4g4 = E.a - d;
|
||||
var r4g5 = E.a - e;
|
||||
var r4g6 = E.a - f;
|
||||
var r4h1 = a - E.b; //ok
|
||||
var r4h2 = b - E.b;
|
||||
var r4h3 = c - E.b; //ok
|
||||
var r4h4 = d - E.b;
|
||||
var r4h5 = e - E.b;
|
||||
var r4h6 = f - E.b;
|
||||
// operator <<
|
||||
var r5a1 = a << a; //ok
|
||||
var r5a2 = a << b;
|
||||
@@ -830,18 +830,18 @@ var r5f3 = f << c;
|
||||
var r5f4 = f << d;
|
||||
var r5f5 = f << e;
|
||||
var r5f6 = f << f;
|
||||
var r5g1 = 0 /* a */ << a; //ok
|
||||
var r5g2 = 0 /* a */ << b;
|
||||
var r5g3 = 0 /* a */ << c; //ok
|
||||
var r5g4 = 0 /* a */ << d;
|
||||
var r5g5 = 0 /* a */ << e;
|
||||
var r5g6 = 0 /* a */ << f;
|
||||
var r5h1 = a << 1 /* b */; //ok
|
||||
var r5h2 = b << 1 /* b */;
|
||||
var r5h3 = c << 1 /* b */; //ok
|
||||
var r5h4 = d << 1 /* b */;
|
||||
var r5h5 = e << 1 /* b */;
|
||||
var r5h6 = f << 1 /* b */;
|
||||
var r5g1 = E.a << a; //ok
|
||||
var r5g2 = E.a << b;
|
||||
var r5g3 = E.a << c; //ok
|
||||
var r5g4 = E.a << d;
|
||||
var r5g5 = E.a << e;
|
||||
var r5g6 = E.a << f;
|
||||
var r5h1 = a << E.b; //ok
|
||||
var r5h2 = b << E.b;
|
||||
var r5h3 = c << E.b; //ok
|
||||
var r5h4 = d << E.b;
|
||||
var r5h5 = e << E.b;
|
||||
var r5h6 = f << E.b;
|
||||
// operator >>
|
||||
var r6a1 = a >> a; //ok
|
||||
var r6a2 = a >> b;
|
||||
@@ -879,18 +879,18 @@ var r6f3 = f >> c;
|
||||
var r6f4 = f >> d;
|
||||
var r6f5 = f >> e;
|
||||
var r6f6 = f >> f;
|
||||
var r6g1 = 0 /* a */ >> a; //ok
|
||||
var r6g2 = 0 /* a */ >> b;
|
||||
var r6g3 = 0 /* a */ >> c; //ok
|
||||
var r6g4 = 0 /* a */ >> d;
|
||||
var r6g5 = 0 /* a */ >> e;
|
||||
var r6g6 = 0 /* a */ >> f;
|
||||
var r6h1 = a >> 1 /* b */; //ok
|
||||
var r6h2 = b >> 1 /* b */;
|
||||
var r6h3 = c >> 1 /* b */; //ok
|
||||
var r6h4 = d >> 1 /* b */;
|
||||
var r6h5 = e >> 1 /* b */;
|
||||
var r6h6 = f >> 1 /* b */;
|
||||
var r6g1 = E.a >> a; //ok
|
||||
var r6g2 = E.a >> b;
|
||||
var r6g3 = E.a >> c; //ok
|
||||
var r6g4 = E.a >> d;
|
||||
var r6g5 = E.a >> e;
|
||||
var r6g6 = E.a >> f;
|
||||
var r6h1 = a >> E.b; //ok
|
||||
var r6h2 = b >> E.b;
|
||||
var r6h3 = c >> E.b; //ok
|
||||
var r6h4 = d >> E.b;
|
||||
var r6h5 = e >> E.b;
|
||||
var r6h6 = f >> E.b;
|
||||
// operator >>>
|
||||
var r7a1 = a >>> a; //ok
|
||||
var r7a2 = a >>> b;
|
||||
@@ -928,18 +928,18 @@ var r7f3 = f >>> c;
|
||||
var r7f4 = f >>> d;
|
||||
var r7f5 = f >>> e;
|
||||
var r7f6 = f >>> f;
|
||||
var r7g1 = 0 /* a */ >>> a; //ok
|
||||
var r7g2 = 0 /* a */ >>> b;
|
||||
var r7g3 = 0 /* a */ >>> c; //ok
|
||||
var r7g4 = 0 /* a */ >>> d;
|
||||
var r7g5 = 0 /* a */ >>> e;
|
||||
var r7g6 = 0 /* a */ >>> f;
|
||||
var r7h1 = a >>> 1 /* b */; //ok
|
||||
var r7h2 = b >>> 1 /* b */;
|
||||
var r7h3 = c >>> 1 /* b */; //ok
|
||||
var r7h4 = d >>> 1 /* b */;
|
||||
var r7h5 = e >>> 1 /* b */;
|
||||
var r7h6 = f >>> 1 /* b */;
|
||||
var r7g1 = E.a >>> a; //ok
|
||||
var r7g2 = E.a >>> b;
|
||||
var r7g3 = E.a >>> c; //ok
|
||||
var r7g4 = E.a >>> d;
|
||||
var r7g5 = E.a >>> e;
|
||||
var r7g6 = E.a >>> f;
|
||||
var r7h1 = a >>> E.b; //ok
|
||||
var r7h2 = b >>> E.b;
|
||||
var r7h3 = c >>> E.b; //ok
|
||||
var r7h4 = d >>> E.b;
|
||||
var r7h5 = e >>> E.b;
|
||||
var r7h6 = f >>> E.b;
|
||||
// operator &
|
||||
var r8a1 = a & a; //ok
|
||||
var r8a2 = a & b;
|
||||
@@ -977,18 +977,18 @@ var r8f3 = f & c;
|
||||
var r8f4 = f & d;
|
||||
var r8f5 = f & e;
|
||||
var r8f6 = f & f;
|
||||
var r8g1 = 0 /* a */ & a; //ok
|
||||
var r8g2 = 0 /* a */ & b;
|
||||
var r8g3 = 0 /* a */ & c; //ok
|
||||
var r8g4 = 0 /* a */ & d;
|
||||
var r8g5 = 0 /* a */ & e;
|
||||
var r8g6 = 0 /* a */ & f;
|
||||
var r8h1 = a & 1 /* b */; //ok
|
||||
var r8h2 = b & 1 /* b */;
|
||||
var r8h3 = c & 1 /* b */; //ok
|
||||
var r8h4 = d & 1 /* b */;
|
||||
var r8h5 = e & 1 /* b */;
|
||||
var r8h6 = f & 1 /* b */;
|
||||
var r8g1 = E.a & a; //ok
|
||||
var r8g2 = E.a & b;
|
||||
var r8g3 = E.a & c; //ok
|
||||
var r8g4 = E.a & d;
|
||||
var r8g5 = E.a & e;
|
||||
var r8g6 = E.a & f;
|
||||
var r8h1 = a & E.b; //ok
|
||||
var r8h2 = b & E.b;
|
||||
var r8h3 = c & E.b; //ok
|
||||
var r8h4 = d & E.b;
|
||||
var r8h5 = e & E.b;
|
||||
var r8h6 = f & E.b;
|
||||
// operator ^
|
||||
var r9a1 = a ^ a; //ok
|
||||
var r9a2 = a ^ b;
|
||||
@@ -1026,18 +1026,18 @@ var r9f3 = f ^ c;
|
||||
var r9f4 = f ^ d;
|
||||
var r9f5 = f ^ e;
|
||||
var r9f6 = f ^ f;
|
||||
var r9g1 = 0 /* a */ ^ a; //ok
|
||||
var r9g2 = 0 /* a */ ^ b;
|
||||
var r9g3 = 0 /* a */ ^ c; //ok
|
||||
var r9g4 = 0 /* a */ ^ d;
|
||||
var r9g5 = 0 /* a */ ^ e;
|
||||
var r9g6 = 0 /* a */ ^ f;
|
||||
var r9h1 = a ^ 1 /* b */; //ok
|
||||
var r9h2 = b ^ 1 /* b */;
|
||||
var r9h3 = c ^ 1 /* b */; //ok
|
||||
var r9h4 = d ^ 1 /* b */;
|
||||
var r9h5 = e ^ 1 /* b */;
|
||||
var r9h6 = f ^ 1 /* b */;
|
||||
var r9g1 = E.a ^ a; //ok
|
||||
var r9g2 = E.a ^ b;
|
||||
var r9g3 = E.a ^ c; //ok
|
||||
var r9g4 = E.a ^ d;
|
||||
var r9g5 = E.a ^ e;
|
||||
var r9g6 = E.a ^ f;
|
||||
var r9h1 = a ^ E.b; //ok
|
||||
var r9h2 = b ^ E.b;
|
||||
var r9h3 = c ^ E.b; //ok
|
||||
var r9h4 = d ^ E.b;
|
||||
var r9h5 = e ^ E.b;
|
||||
var r9h6 = f ^ E.b;
|
||||
// operator |
|
||||
var r10a1 = a | a; //ok
|
||||
var r10a2 = a | b;
|
||||
@@ -1075,15 +1075,15 @@ var r10f3 = f | c;
|
||||
var r10f4 = f | d;
|
||||
var r10f5 = f | e;
|
||||
var r10f6 = f | f;
|
||||
var r10g1 = 0 /* a */ | a; //ok
|
||||
var r10g2 = 0 /* a */ | b;
|
||||
var r10g3 = 0 /* a */ | c; //ok
|
||||
var r10g4 = 0 /* a */ | d;
|
||||
var r10g5 = 0 /* a */ | e;
|
||||
var r10g6 = 0 /* a */ | f;
|
||||
var r10h1 = a | 1 /* b */; //ok
|
||||
var r10h2 = b | 1 /* b */;
|
||||
var r10h3 = c | 1 /* b */; //ok
|
||||
var r10h4 = d | 1 /* b */;
|
||||
var r10h5 = e | 1 /* b */;
|
||||
var r10h6 = f | 1 /* b */;
|
||||
var r10g1 = E.a | a; //ok
|
||||
var r10g2 = E.a | b;
|
||||
var r10g3 = E.a | c; //ok
|
||||
var r10g4 = E.a | d;
|
||||
var r10g5 = E.a | e;
|
||||
var r10g6 = E.a | f;
|
||||
var r10h1 = a | E.b; //ok
|
||||
var r10h2 = b | E.b;
|
||||
var r10h3 = c | E.b; //ok
|
||||
var r10h4 = d | E.b;
|
||||
var r10h5 = e | E.b;
|
||||
var r10h6 = f | E.b;
|
||||
|
||||
@@ -124,89 +124,89 @@ var b;
|
||||
var ra1 = null * a;
|
||||
var ra2 = null * b;
|
||||
var ra3 = null * 1;
|
||||
var ra4 = null * 0 /* a */;
|
||||
var ra4 = null * E.a;
|
||||
var ra5 = a * null;
|
||||
var ra6 = b * null;
|
||||
var ra7 = 0 * null;
|
||||
var ra8 = 1 /* b */ * null;
|
||||
var ra8 = E.b * null;
|
||||
// operator /
|
||||
var rb1 = null / a;
|
||||
var rb2 = null / b;
|
||||
var rb3 = null / 1;
|
||||
var rb4 = null / 0 /* a */;
|
||||
var rb4 = null / E.a;
|
||||
var rb5 = a / null;
|
||||
var rb6 = b / null;
|
||||
var rb7 = 0 / null;
|
||||
var rb8 = 1 /* b */ / null;
|
||||
var rb8 = E.b / null;
|
||||
// operator %
|
||||
var rc1 = null % a;
|
||||
var rc2 = null % b;
|
||||
var rc3 = null % 1;
|
||||
var rc4 = null % 0 /* a */;
|
||||
var rc4 = null % E.a;
|
||||
var rc5 = a % null;
|
||||
var rc6 = b % null;
|
||||
var rc7 = 0 % null;
|
||||
var rc8 = 1 /* b */ % null;
|
||||
var rc8 = E.b % null;
|
||||
// operator -
|
||||
var rd1 = null - a;
|
||||
var rd2 = null - b;
|
||||
var rd3 = null - 1;
|
||||
var rd4 = null - 0 /* a */;
|
||||
var rd4 = null - E.a;
|
||||
var rd5 = a - null;
|
||||
var rd6 = b - null;
|
||||
var rd7 = 0 - null;
|
||||
var rd8 = 1 /* b */ - null;
|
||||
var rd8 = E.b - null;
|
||||
// operator <<
|
||||
var re1 = null << a;
|
||||
var re2 = null << b;
|
||||
var re3 = null << 1;
|
||||
var re4 = null << 0 /* a */;
|
||||
var re4 = null << E.a;
|
||||
var re5 = a << null;
|
||||
var re6 = b << null;
|
||||
var re7 = 0 << null;
|
||||
var re8 = 1 /* b */ << null;
|
||||
var re8 = E.b << null;
|
||||
// operator >>
|
||||
var rf1 = null >> a;
|
||||
var rf2 = null >> b;
|
||||
var rf3 = null >> 1;
|
||||
var rf4 = null >> 0 /* a */;
|
||||
var rf4 = null >> E.a;
|
||||
var rf5 = a >> null;
|
||||
var rf6 = b >> null;
|
||||
var rf7 = 0 >> null;
|
||||
var rf8 = 1 /* b */ >> null;
|
||||
var rf8 = E.b >> null;
|
||||
// operator >>>
|
||||
var rg1 = null >>> a;
|
||||
var rg2 = null >>> b;
|
||||
var rg3 = null >>> 1;
|
||||
var rg4 = null >>> 0 /* a */;
|
||||
var rg4 = null >>> E.a;
|
||||
var rg5 = a >>> null;
|
||||
var rg6 = b >>> null;
|
||||
var rg7 = 0 >>> null;
|
||||
var rg8 = 1 /* b */ >>> null;
|
||||
var rg8 = E.b >>> null;
|
||||
// operator &
|
||||
var rh1 = null & a;
|
||||
var rh2 = null & b;
|
||||
var rh3 = null & 1;
|
||||
var rh4 = null & 0 /* a */;
|
||||
var rh4 = null & E.a;
|
||||
var rh5 = a & null;
|
||||
var rh6 = b & null;
|
||||
var rh7 = 0 & null;
|
||||
var rh8 = 1 /* b */ & null;
|
||||
var rh8 = E.b & null;
|
||||
// operator ^
|
||||
var ri1 = null ^ a;
|
||||
var ri2 = null ^ b;
|
||||
var ri3 = null ^ 1;
|
||||
var ri4 = null ^ 0 /* a */;
|
||||
var ri4 = null ^ E.a;
|
||||
var ri5 = a ^ null;
|
||||
var ri6 = b ^ null;
|
||||
var ri7 = 0 ^ null;
|
||||
var ri8 = 1 /* b */ ^ null;
|
||||
var ri8 = E.b ^ null;
|
||||
// operator |
|
||||
var rj1 = null | a;
|
||||
var rj2 = null | b;
|
||||
var rj3 = null | 1;
|
||||
var rj4 = null | 0 /* a */;
|
||||
var rj4 = null | E.a;
|
||||
var rj5 = a | null;
|
||||
var rj6 = b | null;
|
||||
var rj7 = 0 | null;
|
||||
var rj8 = 1 /* b */ | null;
|
||||
var rj8 = E.b | null;
|
||||
|
||||
@@ -124,89 +124,89 @@ var b;
|
||||
var ra1 = undefined * a;
|
||||
var ra2 = undefined * b;
|
||||
var ra3 = undefined * 1;
|
||||
var ra4 = undefined * 0 /* a */;
|
||||
var ra4 = undefined * E.a;
|
||||
var ra5 = a * undefined;
|
||||
var ra6 = b * undefined;
|
||||
var ra7 = 0 * undefined;
|
||||
var ra8 = 1 /* b */ * undefined;
|
||||
var ra8 = E.b * undefined;
|
||||
// operator /
|
||||
var rb1 = undefined / a;
|
||||
var rb2 = undefined / b;
|
||||
var rb3 = undefined / 1;
|
||||
var rb4 = undefined / 0 /* a */;
|
||||
var rb4 = undefined / E.a;
|
||||
var rb5 = a / undefined;
|
||||
var rb6 = b / undefined;
|
||||
var rb7 = 0 / undefined;
|
||||
var rb8 = 1 /* b */ / undefined;
|
||||
var rb8 = E.b / undefined;
|
||||
// operator %
|
||||
var rc1 = undefined % a;
|
||||
var rc2 = undefined % b;
|
||||
var rc3 = undefined % 1;
|
||||
var rc4 = undefined % 0 /* a */;
|
||||
var rc4 = undefined % E.a;
|
||||
var rc5 = a % undefined;
|
||||
var rc6 = b % undefined;
|
||||
var rc7 = 0 % undefined;
|
||||
var rc8 = 1 /* b */ % undefined;
|
||||
var rc8 = E.b % undefined;
|
||||
// operator -
|
||||
var rd1 = undefined - a;
|
||||
var rd2 = undefined - b;
|
||||
var rd3 = undefined - 1;
|
||||
var rd4 = undefined - 0 /* a */;
|
||||
var rd4 = undefined - E.a;
|
||||
var rd5 = a - undefined;
|
||||
var rd6 = b - undefined;
|
||||
var rd7 = 0 - undefined;
|
||||
var rd8 = 1 /* b */ - undefined;
|
||||
var rd8 = E.b - undefined;
|
||||
// operator <<
|
||||
var re1 = undefined << a;
|
||||
var re2 = undefined << b;
|
||||
var re3 = undefined << 1;
|
||||
var re4 = undefined << 0 /* a */;
|
||||
var re4 = undefined << E.a;
|
||||
var re5 = a << undefined;
|
||||
var re6 = b << undefined;
|
||||
var re7 = 0 << undefined;
|
||||
var re8 = 1 /* b */ << undefined;
|
||||
var re8 = E.b << undefined;
|
||||
// operator >>
|
||||
var rf1 = undefined >> a;
|
||||
var rf2 = undefined >> b;
|
||||
var rf3 = undefined >> 1;
|
||||
var rf4 = undefined >> 0 /* a */;
|
||||
var rf4 = undefined >> E.a;
|
||||
var rf5 = a >> undefined;
|
||||
var rf6 = b >> undefined;
|
||||
var rf7 = 0 >> undefined;
|
||||
var rf8 = 1 /* b */ >> undefined;
|
||||
var rf8 = E.b >> undefined;
|
||||
// operator >>>
|
||||
var rg1 = undefined >>> a;
|
||||
var rg2 = undefined >>> b;
|
||||
var rg3 = undefined >>> 1;
|
||||
var rg4 = undefined >>> 0 /* a */;
|
||||
var rg4 = undefined >>> E.a;
|
||||
var rg5 = a >>> undefined;
|
||||
var rg6 = b >>> undefined;
|
||||
var rg7 = 0 >>> undefined;
|
||||
var rg8 = 1 /* b */ >>> undefined;
|
||||
var rg8 = E.b >>> undefined;
|
||||
// operator &
|
||||
var rh1 = undefined & a;
|
||||
var rh2 = undefined & b;
|
||||
var rh3 = undefined & 1;
|
||||
var rh4 = undefined & 0 /* a */;
|
||||
var rh4 = undefined & E.a;
|
||||
var rh5 = a & undefined;
|
||||
var rh6 = b & undefined;
|
||||
var rh7 = 0 & undefined;
|
||||
var rh8 = 1 /* b */ & undefined;
|
||||
var rh8 = E.b & undefined;
|
||||
// operator ^
|
||||
var ri1 = undefined ^ a;
|
||||
var ri2 = undefined ^ b;
|
||||
var ri3 = undefined ^ 1;
|
||||
var ri4 = undefined ^ 0 /* a */;
|
||||
var ri4 = undefined ^ E.a;
|
||||
var ri5 = a ^ undefined;
|
||||
var ri6 = b ^ undefined;
|
||||
var ri7 = 0 ^ undefined;
|
||||
var ri8 = 1 /* b */ ^ undefined;
|
||||
var ri8 = E.b ^ undefined;
|
||||
// operator |
|
||||
var rj1 = undefined | a;
|
||||
var rj2 = undefined | b;
|
||||
var rj3 = undefined | 1;
|
||||
var rj4 = undefined | 0 /* a */;
|
||||
var rj4 = undefined | E.a;
|
||||
var rj5 = a | undefined;
|
||||
var rj6 = b | undefined;
|
||||
var rj7 = 0 | undefined;
|
||||
var rj8 = 1 /* b */ | undefined;
|
||||
var rj8 = E.b | undefined;
|
||||
|
||||
@@ -61,7 +61,7 @@ var E;
|
||||
E[E["A"] = 0] = "A";
|
||||
})(E || (E = {}));
|
||||
var g = x;
|
||||
var g2 = 0 /* A */;
|
||||
var g2 = E.A;
|
||||
g2 = x;
|
||||
var C = (function () {
|
||||
function C() {
|
||||
|
||||
@@ -77,8 +77,8 @@ var E;
|
||||
(function (E) {
|
||||
E[E["A"] = 0] = "A";
|
||||
})(E || (E = {}));
|
||||
x = 0 /* A */;
|
||||
var f = 0 /* A */;
|
||||
x = E.A;
|
||||
var f = E.A;
|
||||
x = f;
|
||||
var g;
|
||||
x = g;
|
||||
|
||||
@@ -14,6 +14,6 @@ var A;
|
||||
A[A["bar"] = 1] = "bar";
|
||||
})(A || (A = {}));
|
||||
A = undefined; // invalid LHS
|
||||
A = 1 /* bar */; // invalid LHS
|
||||
0 /* foo */ = 1; // invalid LHS
|
||||
0 /* foo */ = 1 /* bar */; // invalid LHS
|
||||
A = A.bar; // invalid LHS
|
||||
A.foo = 1; // invalid LHS
|
||||
A.foo = A.bar; // invalid LHS
|
||||
|
||||
@@ -52,7 +52,7 @@ var E;
|
||||
E[E["A"] = 0] = "A";
|
||||
})(E || (E = {}));
|
||||
E = null; // Error
|
||||
0 /* A */ = null; // OK per spec, Error per implementation (509581)
|
||||
E.A = null; // OK per spec, Error per implementation (509581)
|
||||
function fn() {
|
||||
}
|
||||
fn = null; // Should be error
|
||||
|
||||
@@ -53,16 +53,16 @@ t1 = [
|
||||
f2
|
||||
];
|
||||
t2 = [
|
||||
0 /* one */,
|
||||
0 /* two */
|
||||
E1.one,
|
||||
E2.two
|
||||
];
|
||||
t3 = [
|
||||
5,
|
||||
undefined
|
||||
];
|
||||
t4 = [
|
||||
0 /* one */,
|
||||
0 /* two */,
|
||||
E1.one,
|
||||
E2.two,
|
||||
20
|
||||
];
|
||||
var e1 = t1[2]; // {}
|
||||
|
||||
@@ -30,11 +30,11 @@ var ENUM1;
|
||||
// enum type var
|
||||
var ResultIsNumber1 = ~ENUM1;
|
||||
// enum type expressions
|
||||
var ResultIsNumber2 = ~0 /* "A" */;
|
||||
var ResultIsNumber3 = ~(0 /* A */ + 1 /* "B" */);
|
||||
var ResultIsNumber2 = ~ENUM1["A"];
|
||||
var ResultIsNumber3 = ~(ENUM1.A + ENUM1["B"]);
|
||||
// multiple ~ operators
|
||||
var ResultIsNumber4 = ~~~(0 /* "A" */ + 1 /* B */);
|
||||
var ResultIsNumber4 = ~~~(ENUM1["A"] + ENUM1.B);
|
||||
// miss assignment operators
|
||||
~ENUM1;
|
||||
~0 /* "A" */;
|
||||
~0 /* A */, ~1 /* "B" */;
|
||||
~ENUM1["A"];
|
||||
~ENUM1.A, ~ENUM1["B"];
|
||||
|
||||
@@ -55,12 +55,6 @@ var c = new C(1, 2, ...a);
|
||||
|
||||
|
||||
//// [callWithSpreadES6.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
function foo(x, y, ...z) {
|
||||
}
|
||||
var a;
|
||||
@@ -84,26 +78,23 @@ xa[1].foo(...[
|
||||
2,
|
||||
"abc"
|
||||
]);
|
||||
var C = (function () {
|
||||
function C(x, y, ...z) {
|
||||
class C {
|
||||
constructor(x, y, ...z) {
|
||||
this.foo(x, y);
|
||||
this.foo(x, y, ...z);
|
||||
}
|
||||
C.prototype.foo = function (x, y, ...z) {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
var D = (function (_super) {
|
||||
__extends(D, _super);
|
||||
function D() {
|
||||
_super.call(this, 1, 2);
|
||||
_super.call(this, 1, 2, ...a);
|
||||
foo(x, y, ...z) {
|
||||
}
|
||||
D.prototype.foo = function () {
|
||||
_super.prototype.foo.call(this, 1, 2);
|
||||
_super.prototype.foo.call(this, 1, 2, ...a);
|
||||
};
|
||||
return D;
|
||||
})(C);
|
||||
}
|
||||
class D extends C {
|
||||
constructor() {
|
||||
super(1, 2);
|
||||
super(1, 2, ...a);
|
||||
}
|
||||
foo() {
|
||||
super.foo(1, 2);
|
||||
super.foo(1, 2, ...a);
|
||||
}
|
||||
}
|
||||
// Only supported in when target is ES6
|
||||
var c = new C(1, 2, ...a);
|
||||
|
||||
@@ -97,8 +97,8 @@ var classCDATuple = classCDTuple;
|
||||
var eleFromCDA1 = classCDATuple[2]; // A
|
||||
var eleFromCDA2 = classCDATuple[5]; // C | D | A
|
||||
var t10 = [
|
||||
0 /* one */,
|
||||
0 /* one */
|
||||
E1.one,
|
||||
E2.one
|
||||
];
|
||||
var t11 = t10;
|
||||
var array1 = emptyObjTuple;
|
||||
|
||||
@@ -8,5 +8,5 @@ enum Color {
|
||||
var Color;
|
||||
(function (Color) {
|
||||
Color[Color["Color"] = 0] = "Color";
|
||||
Color[Color["Thing"] = Color.Color] = "Thing";
|
||||
Color[Color["Thing"] = 0] = "Thing";
|
||||
})(Color || (Color = {}));
|
||||
|
||||
@@ -12,6 +12,6 @@ var m1;
|
||||
var e;
|
||||
(function (e) {
|
||||
e[e["m1"] = 0] = "m1";
|
||||
e[e["m2"] = e.m1] = "m2";
|
||||
e[e["m2"] = 0] = "m2";
|
||||
})(e || (e = {}));
|
||||
})(m1 || (m1 = {}));
|
||||
|
||||
@@ -21,8 +21,8 @@ var Colors;
|
||||
/** Fancy name for 'pink'*/
|
||||
Colors[Colors["FancyPink"] = 1] = "FancyPink";
|
||||
})(Colors || (Colors = {})); // trailing comment
|
||||
var x = 0 /* Cornflower */;
|
||||
x = 1 /* FancyPink */;
|
||||
var x = Colors.Cornflower;
|
||||
x = Colors.FancyPink;
|
||||
|
||||
|
||||
//// [commentsEnums.d.ts]
|
||||
|
||||
@@ -80,56 +80,56 @@ var b;
|
||||
// operator <
|
||||
var ra1 = a < b;
|
||||
var ra2 = b < a;
|
||||
var ra3 = 0 /* a */ < b;
|
||||
var ra4 = b < 0 /* a */;
|
||||
var ra5 = 0 /* a */ < 0;
|
||||
var ra6 = 0 < 0 /* a */;
|
||||
var ra3 = E.a < b;
|
||||
var ra4 = b < E.a;
|
||||
var ra5 = E.a < 0;
|
||||
var ra6 = 0 < E.a;
|
||||
// operator >
|
||||
var rb1 = a > b;
|
||||
var rb2 = b > a;
|
||||
var rb3 = 0 /* a */ > b;
|
||||
var rb4 = b > 0 /* a */;
|
||||
var rb5 = 0 /* a */ > 0;
|
||||
var rb6 = 0 > 0 /* a */;
|
||||
var rb3 = E.a > b;
|
||||
var rb4 = b > E.a;
|
||||
var rb5 = E.a > 0;
|
||||
var rb6 = 0 > E.a;
|
||||
// operator <=
|
||||
var rc1 = a <= b;
|
||||
var rc2 = b <= a;
|
||||
var rc3 = 0 /* a */ <= b;
|
||||
var rc4 = b <= 0 /* a */;
|
||||
var rc5 = 0 /* a */ <= 0;
|
||||
var rc6 = 0 <= 0 /* a */;
|
||||
var rc3 = E.a <= b;
|
||||
var rc4 = b <= E.a;
|
||||
var rc5 = E.a <= 0;
|
||||
var rc6 = 0 <= E.a;
|
||||
// operator >=
|
||||
var rd1 = a >= b;
|
||||
var rd2 = b >= a;
|
||||
var rd3 = 0 /* a */ >= b;
|
||||
var rd4 = b >= 0 /* a */;
|
||||
var rd5 = 0 /* a */ >= 0;
|
||||
var rd6 = 0 >= 0 /* a */;
|
||||
var rd3 = E.a >= b;
|
||||
var rd4 = b >= E.a;
|
||||
var rd5 = E.a >= 0;
|
||||
var rd6 = 0 >= E.a;
|
||||
// operator ==
|
||||
var re1 = a == b;
|
||||
var re2 = b == a;
|
||||
var re3 = 0 /* a */ == b;
|
||||
var re4 = b == 0 /* a */;
|
||||
var re5 = 0 /* a */ == 0;
|
||||
var re6 = 0 == 0 /* a */;
|
||||
var re3 = E.a == b;
|
||||
var re4 = b == E.a;
|
||||
var re5 = E.a == 0;
|
||||
var re6 = 0 == E.a;
|
||||
// operator !=
|
||||
var rf1 = a != b;
|
||||
var rf2 = b != a;
|
||||
var rf3 = 0 /* a */ != b;
|
||||
var rf4 = b != 0 /* a */;
|
||||
var rf5 = 0 /* a */ != 0;
|
||||
var rf6 = 0 != 0 /* a */;
|
||||
var rf3 = E.a != b;
|
||||
var rf4 = b != E.a;
|
||||
var rf5 = E.a != 0;
|
||||
var rf6 = 0 != E.a;
|
||||
// operator ===
|
||||
var rg1 = a === b;
|
||||
var rg2 = b === a;
|
||||
var rg3 = 0 /* a */ === b;
|
||||
var rg4 = b === 0 /* a */;
|
||||
var rg5 = 0 /* a */ === 0;
|
||||
var rg6 = 0 === 0 /* a */;
|
||||
var rg3 = E.a === b;
|
||||
var rg4 = b === E.a;
|
||||
var rg5 = E.a === 0;
|
||||
var rg6 = 0 === E.a;
|
||||
// operator !==
|
||||
var rh1 = a !== b;
|
||||
var rh2 = b !== a;
|
||||
var rh3 = 0 /* a */ !== b;
|
||||
var rh4 = b !== 0 /* a */;
|
||||
var rh5 = 0 /* a */ !== 0;
|
||||
var rh6 = 0 !== 0 /* a */;
|
||||
var rh3 = E.a !== b;
|
||||
var rh4 = b !== E.a;
|
||||
var rh5 = E.a !== 0;
|
||||
var rh6 = 0 !== E.a;
|
||||
|
||||
@@ -64,7 +64,7 @@ x1 += b;
|
||||
x1 += true;
|
||||
x1 += 0;
|
||||
x1 += '';
|
||||
x1 += 0 /* a */;
|
||||
x1 += E.a;
|
||||
x1 += {};
|
||||
x1 += null;
|
||||
x1 += undefined;
|
||||
@@ -74,20 +74,20 @@ x2 += b;
|
||||
x2 += true;
|
||||
x2 += 0;
|
||||
x2 += '';
|
||||
x2 += 0 /* a */;
|
||||
x2 += E.a;
|
||||
x2 += {};
|
||||
x2 += null;
|
||||
x2 += undefined;
|
||||
var x3;
|
||||
x3 += a;
|
||||
x3 += 0;
|
||||
x3 += 0 /* a */;
|
||||
x3 += E.a;
|
||||
x3 += null;
|
||||
x3 += undefined;
|
||||
var x4;
|
||||
x4 += a;
|
||||
x4 += 0;
|
||||
x4 += 0 /* a */;
|
||||
x4 += E.a;
|
||||
x4 += null;
|
||||
x4 += undefined;
|
||||
var x5;
|
||||
|
||||
@@ -51,7 +51,7 @@ var x1;
|
||||
x1 += a;
|
||||
x1 += true;
|
||||
x1 += 0;
|
||||
x1 += 0 /* a */;
|
||||
x1 += E.a;
|
||||
x1 += {};
|
||||
x1 += null;
|
||||
x1 += undefined;
|
||||
@@ -59,7 +59,7 @@ var x2;
|
||||
x2 += a;
|
||||
x2 += true;
|
||||
x2 += 0;
|
||||
x2 += 0 /* a */;
|
||||
x2 += E.a;
|
||||
x2 += {};
|
||||
x2 += null;
|
||||
x2 += undefined;
|
||||
@@ -67,7 +67,7 @@ var x3;
|
||||
x3 += a;
|
||||
x3 += true;
|
||||
x3 += 0;
|
||||
x3 += 0 /* a */;
|
||||
x3 += E.a;
|
||||
x3 += {};
|
||||
x3 += null;
|
||||
x3 += undefined;
|
||||
|
||||
@@ -74,7 +74,7 @@ x1 *= b;
|
||||
x1 *= true;
|
||||
x1 *= 0;
|
||||
x1 *= '';
|
||||
x1 *= 0 /* a */;
|
||||
x1 *= E.a;
|
||||
x1 *= {};
|
||||
x1 *= null;
|
||||
x1 *= undefined;
|
||||
@@ -84,7 +84,7 @@ x2 *= b;
|
||||
x2 *= true;
|
||||
x2 *= 0;
|
||||
x2 *= '';
|
||||
x2 *= 0 /* a */;
|
||||
x2 *= E.a;
|
||||
x2 *= {};
|
||||
x2 *= null;
|
||||
x2 *= undefined;
|
||||
@@ -94,7 +94,7 @@ x3 *= b;
|
||||
x3 *= true;
|
||||
x3 *= 0;
|
||||
x3 *= '';
|
||||
x3 *= 0 /* a */;
|
||||
x3 *= E.a;
|
||||
x3 *= {};
|
||||
x3 *= null;
|
||||
x3 *= undefined;
|
||||
@@ -104,7 +104,7 @@ x4 *= b;
|
||||
x4 *= true;
|
||||
x4 *= 0;
|
||||
x4 *= '';
|
||||
x4 *= 0 /* a */;
|
||||
x4 *= E.a;
|
||||
x4 *= {};
|
||||
x4 *= null;
|
||||
x4 *= undefined;
|
||||
|
||||
@@ -20,12 +20,11 @@ class C {
|
||||
var s;
|
||||
var n;
|
||||
var a;
|
||||
var C = (function () {
|
||||
function C() {
|
||||
class C {
|
||||
constructor() {
|
||||
this[n] = n;
|
||||
this[s + n] = 2;
|
||||
this[`hello bye`] = 0;
|
||||
}
|
||||
C[`hello ${a} bye`] = 0;
|
||||
return C;
|
||||
})();
|
||||
}
|
||||
C[`hello ${a} bye`] = 0;
|
||||
|
||||
@@ -20,30 +20,27 @@ class C {
|
||||
var s;
|
||||
var n;
|
||||
var a;
|
||||
var C = (function () {
|
||||
function C() {
|
||||
class C {
|
||||
[s]() {
|
||||
}
|
||||
C.prototype[s] = function () {
|
||||
};
|
||||
C.prototype[n] = function () {
|
||||
};
|
||||
C[s + s] = function () {
|
||||
};
|
||||
C.prototype[s + n] = function () {
|
||||
};
|
||||
C.prototype[+s] = function () {
|
||||
};
|
||||
C[""] = function () {
|
||||
};
|
||||
C.prototype[0] = function () {
|
||||
};
|
||||
C.prototype[a] = function () {
|
||||
};
|
||||
C[true] = function () {
|
||||
};
|
||||
C.prototype[`hello bye`] = function () {
|
||||
};
|
||||
C[`hello ${a} bye`] = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
[n]() {
|
||||
}
|
||||
static [s + s]() {
|
||||
}
|
||||
[s + n]() {
|
||||
}
|
||||
[+s]() {
|
||||
}
|
||||
static [""]() {
|
||||
}
|
||||
[0]() {
|
||||
}
|
||||
[a]() {
|
||||
}
|
||||
static [true]() {
|
||||
}
|
||||
[`hello bye`]() {
|
||||
}
|
||||
static [`hello ${a} bye`]() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,20 +11,17 @@ class C {
|
||||
|
||||
//// [computedPropertyNames14_ES6.js]
|
||||
var b;
|
||||
var C = (function () {
|
||||
function C() {
|
||||
class C {
|
||||
[b]() {
|
||||
}
|
||||
C.prototype[b] = function () {
|
||||
};
|
||||
C[true] = function () {
|
||||
};
|
||||
C.prototype[[]] = function () {
|
||||
};
|
||||
C[{}] = function () {
|
||||
};
|
||||
C.prototype[undefined] = function () {
|
||||
};
|
||||
C[null] = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
static [true]() {
|
||||
}
|
||||
[[]]() {
|
||||
}
|
||||
static [{}]() {
|
||||
}
|
||||
[undefined]() {
|
||||
}
|
||||
static [null]() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,14 +12,11 @@ class C {
|
||||
var p1;
|
||||
var p2;
|
||||
var p3;
|
||||
var C = (function () {
|
||||
function C() {
|
||||
class C {
|
||||
[p1]() {
|
||||
}
|
||||
C.prototype[p1] = function () {
|
||||
};
|
||||
C.prototype[p2] = function () {
|
||||
};
|
||||
C.prototype[p3] = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
[p2]() {
|
||||
}
|
||||
[p3]() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,80 +20,33 @@ class C {
|
||||
var s;
|
||||
var n;
|
||||
var a;
|
||||
var C = (function () {
|
||||
function C() {
|
||||
class C {
|
||||
get [s]() {
|
||||
return 0;
|
||||
}
|
||||
Object.defineProperty(C.prototype, s, {
|
||||
get: function () {
|
||||
return 0;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, n, {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C, s + s, {
|
||||
get: function () {
|
||||
return 0;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, s + n, {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, +s, {
|
||||
get: function () {
|
||||
return 0;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C, "", {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, 0, {
|
||||
get: function () {
|
||||
return 0;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, a, {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C, true, {
|
||||
get: function () {
|
||||
return 0;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, `hello bye`, {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, `hello ${a} bye`, {
|
||||
get: function () {
|
||||
return 0;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
})();
|
||||
set [n](v) {
|
||||
}
|
||||
static get [s + s]() {
|
||||
return 0;
|
||||
}
|
||||
set [s + n](v) {
|
||||
}
|
||||
get [+s]() {
|
||||
return 0;
|
||||
}
|
||||
static set [""](v) {
|
||||
}
|
||||
get [0]() {
|
||||
return 0;
|
||||
}
|
||||
set [a](v) {
|
||||
}
|
||||
static get [true]() {
|
||||
return 0;
|
||||
}
|
||||
set [`hello bye`](v) {
|
||||
}
|
||||
get [`hello ${a} bye`]() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,47 +11,20 @@ class C {
|
||||
|
||||
//// [computedPropertyNames17_ES6.js]
|
||||
var b;
|
||||
var C = (function () {
|
||||
function C() {
|
||||
class C {
|
||||
get [b]() {
|
||||
return 0;
|
||||
}
|
||||
Object.defineProperty(C.prototype, b, {
|
||||
get: function () {
|
||||
return 0;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C, true, {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, [], {
|
||||
get: function () {
|
||||
return 0;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, {}, {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C, undefined, {
|
||||
get: function () {
|
||||
return 0;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, null, {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
})();
|
||||
static set [true](v) {
|
||||
}
|
||||
get [[]]() {
|
||||
return 0;
|
||||
}
|
||||
set [{}](v) {
|
||||
}
|
||||
static get [undefined]() {
|
||||
return 0;
|
||||
}
|
||||
set [null](v) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,13 +7,10 @@ class C {
|
||||
}
|
||||
|
||||
//// [computedPropertyNames21_ES6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.bar = function () {
|
||||
class C {
|
||||
bar() {
|
||||
return 0;
|
||||
};
|
||||
C.prototype[this.bar()] = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
}
|
||||
[this.bar()]() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,15 +9,12 @@ class C {
|
||||
}
|
||||
|
||||
//// [computedPropertyNames22_ES6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.bar = function () {
|
||||
class C {
|
||||
bar() {
|
||||
var obj = {
|
||||
[this.bar()]() {
|
||||
}
|
||||
};
|
||||
return 0;
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,15 +9,12 @@ class C {
|
||||
}
|
||||
|
||||
//// [computedPropertyNames23_ES6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.bar = function () {
|
||||
class C {
|
||||
bar() {
|
||||
return 0;
|
||||
};
|
||||
C.prototype[{
|
||||
}
|
||||
[{
|
||||
[this.bar()]: 1
|
||||
}[0]] = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
}[0]]() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts(9,6): error TS2466: 'super' cannot be referenced in a computed property name.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts(7,6): error TS2466: 'super' cannot be referenced in a computed property name.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts (1 errors) ====
|
||||
@@ -8,8 +8,6 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts(9,
|
||||
}
|
||||
}
|
||||
class C extends Base {
|
||||
// Gets emitted as super, not _super, which is consistent with
|
||||
// use of super in static properties initializers.
|
||||
[super.bar()]() { }
|
||||
~~~~~
|
||||
!!! error TS2466: 'super' cannot be referenced in a computed property name.
|
||||
|
||||
@@ -5,8 +5,6 @@ class Base {
|
||||
}
|
||||
}
|
||||
class C extends Base {
|
||||
// Gets emitted as super, not _super, which is consistent with
|
||||
// use of super in static properties initializers.
|
||||
[super.bar()]() { }
|
||||
}
|
||||
|
||||
@@ -30,9 +28,7 @@ var C = (function (_super) {
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
// Gets emitted as super, not _super, which is consistent with
|
||||
// use of super in static properties initializers.
|
||||
C.prototype[super.bar.call(this)] = function () {
|
||||
C.prototype[_super.bar.call(this)] = function () {
|
||||
};
|
||||
return C;
|
||||
})(Base);
|
||||
|
||||
@@ -11,28 +11,14 @@ class C extends Base {
|
||||
}
|
||||
|
||||
//// [computedPropertyNames24_ES6.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var Base = (function () {
|
||||
function Base() {
|
||||
}
|
||||
Base.prototype.bar = function () {
|
||||
class Base {
|
||||
bar() {
|
||||
return 0;
|
||||
};
|
||||
return Base;
|
||||
})();
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
class C extends Base {
|
||||
// Gets emitted as super, not _super, which is consistent with
|
||||
// use of super in static properties initializers.
|
||||
C.prototype[super.bar.call(this)] = function () {
|
||||
};
|
||||
return C;
|
||||
})(Base);
|
||||
[super.bar()]() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,31 +14,17 @@ class C extends Base {
|
||||
}
|
||||
|
||||
//// [computedPropertyNames25_ES6.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var Base = (function () {
|
||||
function Base() {
|
||||
}
|
||||
Base.prototype.bar = function () {
|
||||
class Base {
|
||||
bar() {
|
||||
return 0;
|
||||
};
|
||||
return Base;
|
||||
})();
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
C.prototype.foo = function () {
|
||||
}
|
||||
class C extends Base {
|
||||
foo() {
|
||||
var obj = {
|
||||
[_super.prototype.bar.call(this)]() {
|
||||
[super.bar()]() {
|
||||
}
|
||||
};
|
||||
return 0;
|
||||
};
|
||||
return C;
|
||||
})(Base);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts(10,12): error TS2466: 'super' cannot be referenced in a computed property name.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts(8,12): error TS2466: 'super' cannot be referenced in a computed property name.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts (1 errors) ====
|
||||
@@ -8,8 +8,6 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts(10
|
||||
}
|
||||
}
|
||||
class C extends Base {
|
||||
// Gets emitted as super, not _super, which is consistent with
|
||||
// use of super in static properties initializers.
|
||||
[
|
||||
{ [super.bar()]: 1 }[0]
|
||||
~~~~~
|
||||
|
||||
@@ -5,8 +5,6 @@ class Base {
|
||||
}
|
||||
}
|
||||
class C extends Base {
|
||||
// Gets emitted as super, not _super, which is consistent with
|
||||
// use of super in static properties initializers.
|
||||
[
|
||||
{ [super.bar()]: 1 }[0]
|
||||
]() { }
|
||||
@@ -32,10 +30,8 @@ var C = (function (_super) {
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
// Gets emitted as super, not _super, which is consistent with
|
||||
// use of super in static properties initializers.
|
||||
C.prototype[(_a = {},
|
||||
_a[super.bar.call(this)] = 1,
|
||||
_a[_super.bar.call(this)] = 1,
|
||||
_a)[0]] = function () {
|
||||
};
|
||||
return C;
|
||||
|
||||
@@ -13,30 +13,16 @@ class C extends Base {
|
||||
}
|
||||
|
||||
//// [computedPropertyNames26_ES6.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var Base = (function () {
|
||||
function Base() {
|
||||
}
|
||||
Base.prototype.bar = function () {
|
||||
class Base {
|
||||
bar() {
|
||||
return 0;
|
||||
};
|
||||
return Base;
|
||||
})();
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
class C extends Base {
|
||||
// Gets emitted as super, not _super, which is consistent with
|
||||
// use of super in static properties initializers.
|
||||
C.prototype[{
|
||||
[super.bar.call(this)]: 1
|
||||
}[0]] = function () {
|
||||
};
|
||||
return C;
|
||||
})(Base);
|
||||
[{
|
||||
[super.bar()]: 1
|
||||
}[0]]() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,23 +6,9 @@ class C extends Base {
|
||||
}
|
||||
|
||||
//// [computedPropertyNames27_ES6.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var Base = (function () {
|
||||
function Base() {
|
||||
class Base {
|
||||
}
|
||||
class C extends Base {
|
||||
[(super(), "prop")]() {
|
||||
}
|
||||
return Base;
|
||||
})();
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
C.prototype[(_super.call(this), "prop")] = function () {
|
||||
};
|
||||
return C;
|
||||
})(Base);
|
||||
}
|
||||
|
||||
@@ -11,25 +11,14 @@ class C extends Base {
|
||||
}
|
||||
|
||||
//// [computedPropertyNames28_ES6.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var Base = (function () {
|
||||
function Base() {
|
||||
}
|
||||
return Base;
|
||||
})();
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.call(this);
|
||||
class Base {
|
||||
}
|
||||
class C extends Base {
|
||||
constructor() {
|
||||
super();
|
||||
var obj = {
|
||||
[(_super.call(this), "prop")]() {
|
||||
[(super(), "prop")]() {
|
||||
}
|
||||
};
|
||||
}
|
||||
return C;
|
||||
})(Base);
|
||||
}
|
||||
|
||||
@@ -11,10 +11,8 @@ class C {
|
||||
}
|
||||
|
||||
//// [computedPropertyNames29_ES6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.bar = function () {
|
||||
class C {
|
||||
bar() {
|
||||
(() => {
|
||||
var obj = {
|
||||
[this.bar()]() {
|
||||
@@ -22,6 +20,5 @@ var C = (function () {
|
||||
};
|
||||
});
|
||||
return 0;
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,36 +13,17 @@ class C {
|
||||
//// [computedPropertyNames2_ES6.js]
|
||||
var methodName = "method";
|
||||
var accessorName = "accessor";
|
||||
var C = (function () {
|
||||
function C() {
|
||||
class C {
|
||||
[methodName]() {
|
||||
}
|
||||
C.prototype[methodName] = function () {
|
||||
};
|
||||
C[methodName] = function () {
|
||||
};
|
||||
Object.defineProperty(C.prototype, accessorName, {
|
||||
get: function () {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, accessorName, {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C, accessorName, {
|
||||
get: function () {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C, accessorName, {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
})();
|
||||
static [methodName]() {
|
||||
}
|
||||
get [accessorName]() {
|
||||
}
|
||||
set [accessorName](v) {
|
||||
}
|
||||
static get [accessorName]() {
|
||||
}
|
||||
static set [accessorName](v) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,30 +16,19 @@ class C extends Base {
|
||||
}
|
||||
|
||||
//// [computedPropertyNames30_ES6.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var Base = (function () {
|
||||
function Base() {
|
||||
}
|
||||
return Base;
|
||||
})();
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.call(this);
|
||||
class Base {
|
||||
}
|
||||
class C extends Base {
|
||||
constructor() {
|
||||
super();
|
||||
(() => {
|
||||
var obj = {
|
||||
// Ideally, we would capture this. But the reference is
|
||||
// illegal, and not capturing this is consistent with
|
||||
//treatment of other similar violations.
|
||||
[(_super.call(this), "prop")]() {
|
||||
[(super(), "prop")]() {
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
return C;
|
||||
})(Base);
|
||||
}
|
||||
|
||||
@@ -16,34 +16,20 @@ class C extends Base {
|
||||
}
|
||||
|
||||
//// [computedPropertyNames31_ES6.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var Base = (function () {
|
||||
function Base() {
|
||||
}
|
||||
Base.prototype.bar = function () {
|
||||
class Base {
|
||||
bar() {
|
||||
return 0;
|
||||
};
|
||||
return Base;
|
||||
})();
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
C.prototype.foo = function () {
|
||||
}
|
||||
class C extends Base {
|
||||
foo() {
|
||||
var _this = this;
|
||||
(() => {
|
||||
var obj = {
|
||||
[_super.prototype.bar.call(_this)]() {
|
||||
[super.bar()]() {
|
||||
} // needs capture
|
||||
};
|
||||
});
|
||||
return 0;
|
||||
};
|
||||
return C;
|
||||
})(Base);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,13 +11,10 @@ class C<T> {
|
||||
function foo() {
|
||||
return '';
|
||||
}
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.bar = function () {
|
||||
class C {
|
||||
bar() {
|
||||
return 0;
|
||||
};
|
||||
C.prototype[foo()] = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
}
|
||||
[foo()]() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,15 +13,12 @@ class C<T> {
|
||||
function foo() {
|
||||
return '';
|
||||
}
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.bar = function () {
|
||||
class C {
|
||||
bar() {
|
||||
var obj = {
|
||||
[foo()]() {
|
||||
}
|
||||
};
|
||||
return 0;
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,15 +13,12 @@ class C<T> {
|
||||
function foo() {
|
||||
return '';
|
||||
}
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.bar = function () {
|
||||
class C {
|
||||
static bar() {
|
||||
var obj = {
|
||||
[foo()]() {
|
||||
}
|
||||
};
|
||||
return 0;
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,32 +11,15 @@ class C {
|
||||
}
|
||||
|
||||
//// [computedPropertyNames36_ES6.js]
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
class Foo {
|
||||
}
|
||||
class Foo2 {
|
||||
}
|
||||
class C {
|
||||
// Computed properties
|
||||
get ["get1"]() {
|
||||
return new Foo;
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
var Foo2 = (function () {
|
||||
function Foo2() {
|
||||
set ["set1"](p) {
|
||||
}
|
||||
return Foo2;
|
||||
})();
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
Object.defineProperty(C.prototype, "get1", {
|
||||
// Computed properties
|
||||
get: function () {
|
||||
return new Foo;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, "set1", {
|
||||
set: function (p) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
})();
|
||||
}
|
||||
|
||||
@@ -11,32 +11,15 @@ class C {
|
||||
}
|
||||
|
||||
//// [computedPropertyNames37_ES6.js]
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
class Foo {
|
||||
}
|
||||
class Foo2 {
|
||||
}
|
||||
class C {
|
||||
// Computed properties
|
||||
get ["get1"]() {
|
||||
return new Foo;
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
var Foo2 = (function () {
|
||||
function Foo2() {
|
||||
set ["set1"](p) {
|
||||
}
|
||||
return Foo2;
|
||||
})();
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
Object.defineProperty(C.prototype, "get1", {
|
||||
// Computed properties
|
||||
get: function () {
|
||||
return new Foo;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, "set1", {
|
||||
set: function (p) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
})();
|
||||
}
|
||||
|
||||
@@ -11,32 +11,15 @@ class C {
|
||||
}
|
||||
|
||||
//// [computedPropertyNames38_ES6.js]
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
class Foo {
|
||||
}
|
||||
class Foo2 {
|
||||
}
|
||||
class C {
|
||||
// Computed properties
|
||||
get [1 << 6]() {
|
||||
return new Foo;
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
var Foo2 = (function () {
|
||||
function Foo2() {
|
||||
set [1 << 6](p) {
|
||||
}
|
||||
return Foo2;
|
||||
})();
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
Object.defineProperty(C.prototype, 1 << 6, {
|
||||
// Computed properties
|
||||
get: function () {
|
||||
return new Foo;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, 1 << 6, {
|
||||
set: function (p) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
})();
|
||||
}
|
||||
|
||||
@@ -11,32 +11,15 @@ class C {
|
||||
}
|
||||
|
||||
//// [computedPropertyNames39_ES6.js]
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
class Foo {
|
||||
}
|
||||
class Foo2 {
|
||||
}
|
||||
class C {
|
||||
// Computed properties
|
||||
get [1 << 6]() {
|
||||
return new Foo;
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
var Foo2 = (function () {
|
||||
function Foo2() {
|
||||
set [1 << 6](p) {
|
||||
}
|
||||
return Foo2;
|
||||
})();
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
Object.defineProperty(C.prototype, 1 << 6, {
|
||||
// Computed properties
|
||||
get: function () {
|
||||
return new Foo;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, 1 << 6, {
|
||||
set: function (p) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
})();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user