do not use for-of and const

https://github.com/Microsoft/TypeScript/issues/10220
This commit is contained in:
Johannes Rieken 2016-08-09 10:41:21 +02:00
parent 28550cff75
commit fbebca5527
9 changed files with 15 additions and 15 deletions

View file

@ -82,7 +82,7 @@ namespace ast {
let start = -1;
let end = Number.MAX_VALUE;
for (const name of dottedName.split('.')) {
for (let name of dottedName.split('.')) {
let idx: number;
while ((idx = identifiers.indexOf(name, idx + 1)) >= 0) {
let myStart = spans[2 * idx];

View file

@ -959,13 +959,13 @@ export function emmet<T extends HTMLElement>(description: string): T {
}
export function show(...elements: HTMLElement[]): void {
for (const element of elements) {
for (let element of elements) {
element.style.display = null;
}
}
export function hide(...elements: HTMLElement[]): void {
for (const element of elements) {
for (let element of elements) {
element.style.display = 'none';
}
}

View file

@ -67,7 +67,7 @@ class Trait<T> implements IDisposable {
const end = start + deleteCount;
const indexes = [];
for (const index of indexes) {
for (let index of indexes) {
if (index >= start && index < end) {
continue;
}

View file

@ -69,7 +69,7 @@ export function each(range: IRange, fn: (index : number) => void): void {
export function groupIntersect(range: IRange, groups: IRangedGroup[]): IRangedGroup[] {
const result: IRangedGroup[] = [];
for (const r of groups) {
for (let r of groups) {
if (range.start >= r.range.end) {
continue;
}
@ -110,7 +110,7 @@ export function consolidate(groups: IRangedGroup[]): IRangedGroup[] {
const result: IRangedGroup[] = [];
let previousGroup: IRangedGroup = null;
for (const group of groups) {
for (let group of groups) {
const start = group.range.start;
const end = group.range.end;
const size = group.size;
@ -186,7 +186,7 @@ export class RangeMap {
let index = 0;
let size = 0;
for (const group of this.groups) {
for (let group of this.groups) {
const count = group.range.end - group.range.start;
const newSize = size + (count * group.size);
@ -220,7 +220,7 @@ export class RangeMap {
let position = 0;
let count = 0;
for (const group of this.groups) {
for (let group of this.groups) {
const groupCount = group.range.end - group.range.start;
const newCount = count + groupCount;

View file

@ -124,7 +124,7 @@ class ContextMenuController implements IEditorContribution {
const result: IAction[] = [];
const groups = this._contextMenu.getActions();
for (const group of groups) {
for (let group of groups) {
const [, actions] = group;
result.push(...actions);
result.push(new Separator());

View file

@ -43,7 +43,7 @@ export class CompletionModel {
constructor(raw: ISuggestionItem[], leadingLineContent: string) {
this.raw = raw;
this._lineContext = { leadingLineContent, characterCountDelta: 0 };
for (const item of raw) {
for (let item of raw) {
this._items.push(new CompletionItem(item));
}
}

View file

@ -243,7 +243,7 @@ class ExtHostApiCommands {
return this._commands.executeCommand<[IWorkspaceSymbolProvider, IWorkspaceSymbol[]][]>('_executeWorkspaceSymbolProvider', { query }).then(value => {
const result: types.SymbolInformation[] = [];
if (Array.isArray(value)) {
for (const tuple of value) {
for (let tuple of value) {
result.push(...tuple[1].map(typeConverters.toSymbolInformation));
}
}
@ -343,7 +343,7 @@ class ExtHostApiCommands {
if (values) {
let items: types.CompletionItem[] = [];
let incomplete: boolean;
for (const item of values) {
for (let item of values) {
incomplete = item.container.incomplete || incomplete;
items.push(typeConverters.Suggest.to(item.container, position, item.suggestion));
}

View file

@ -102,7 +102,7 @@ export class DiagnosticCollection implements vscode.DiagnosticCollection {
marker = [];
const order = [DiagnosticSeverity.Error, DiagnosticSeverity.Warning, DiagnosticSeverity.Information, DiagnosticSeverity.Hint];
orderLoop: for (let i = 0; i < 4; i++) {
for (const diagnostic of diagnostics) {
for (let diagnostic of diagnostics) {
if (diagnostic.severity === order[i]) {
const len = marker.push(DiagnosticCollection._toMarkerData(diagnostic));
if (len === DiagnosticCollection._maxDiagnosticsPerFile) {

View file

@ -160,7 +160,7 @@ export class OpenSymbolHandler extends QuickOpenHandler {
private doGetResults(searchValue: string): TPromise<SymbolEntry[]> {
return getWorkspaceSymbols(searchValue).then(tuples => {
const result: SymbolEntry[] = [];
for (const tuple of tuples) {
for (let tuple of tuples) {
const [provider, bearings] = tuple;
this.fillInSymbolEntries(result, provider, bearings, searchValue);
}
@ -178,7 +178,7 @@ export class OpenSymbolHandler extends QuickOpenHandler {
private fillInSymbolEntries(bucket: SymbolEntry[], provider: IWorkspaceSymbolProvider, types: IWorkspaceSymbol[], searchValue: string): void {
// Convert to Entries
for (const element of types) {
for (let element of types) {
if (this.options.skipLocalSymbols && !!element.containerName) {
continue; // ignore local symbols if we are told so