mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-28 07:40:30 -04:00
Initial VS Code 1.19 source merge (#571)
* Initial 1.19 xcopy * Fix yarn build * Fix numerous build breaks * Next batch of build break fixes * More build break fixes * Runtime breaks * Additional post merge fixes * Fix windows setup file * Fix test failures. * Update license header blocks to refer to source eula
This commit is contained in:
@@ -4,51 +4,17 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { illegalArgument } from 'vs/base/common/errors';
|
||||
import * as instantiation from './instantiation';
|
||||
|
||||
export class AbstractDescriptor<T> {
|
||||
|
||||
constructor(private _staticArguments: any[]) {
|
||||
// empty
|
||||
}
|
||||
export class SyncDescriptor<T> {
|
||||
|
||||
public appendStaticArguments(more: any[]): void {
|
||||
this._staticArguments.push.apply(this._staticArguments, more);
|
||||
}
|
||||
readonly ctor: any;
|
||||
readonly staticArguments: any[];
|
||||
|
||||
public staticArguments(): any[];
|
||||
public staticArguments(nth: number): any;
|
||||
public staticArguments(nth?: number): any[] {
|
||||
if (isNaN(nth)) {
|
||||
return this._staticArguments.slice(0);
|
||||
} else {
|
||||
return this._staticArguments[nth];
|
||||
}
|
||||
}
|
||||
|
||||
_validate(type: T): void {
|
||||
if (!type) {
|
||||
throw illegalArgument('can not be falsy');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class SyncDescriptor<T> extends AbstractDescriptor<T> {
|
||||
|
||||
constructor(private _ctor: any, ...staticArguments: any[]) {
|
||||
super(staticArguments);
|
||||
}
|
||||
|
||||
public get ctor(): any {
|
||||
return this._ctor;
|
||||
}
|
||||
|
||||
protected bind(...moreStaticArguments: any[]): SyncDescriptor<T> {
|
||||
let allArgs: any[] = [];
|
||||
allArgs = allArgs.concat(this.staticArguments());
|
||||
allArgs = allArgs.concat(moreStaticArguments);
|
||||
return new SyncDescriptor<T>(this._ctor, ...allArgs);
|
||||
constructor(ctor: new (...args: any[]) => T, ..._staticArguments: any[]) {
|
||||
this.ctor = ctor;
|
||||
this.staticArguments = _staticArguments;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,4 +141,4 @@ export interface SyncDescriptor8<A1, A2, A3, A4, A5, A6, A7, A8, T> {
|
||||
bind(a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6): SyncDescriptor2<A7, A8, T>;
|
||||
bind(a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7): SyncDescriptor1<A8, T>;
|
||||
bind(a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8): SyncDescriptor0<T>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ export class InstantiationService implements IInstantiationService {
|
||||
}
|
||||
}
|
||||
|
||||
createInstance<T>(param: any, ...rest: any[]): any {
|
||||
createInstance(param: any, ...rest: any[]): any {
|
||||
|
||||
if (param instanceof SyncDescriptor) {
|
||||
// sync
|
||||
@@ -77,7 +77,7 @@ export class InstantiationService implements IInstantiationService {
|
||||
private _createInstance<T>(desc: SyncDescriptor<T>, args: any[]): T {
|
||||
|
||||
// arguments given by createInstance-call and/or the descriptor
|
||||
let staticArgs = desc.staticArguments().concat(args);
|
||||
let staticArgs = desc.staticArguments.concat(args);
|
||||
|
||||
// arguments defined by service decorators
|
||||
let serviceDependencies = _util.getServiceDependencies(desc.ctor).sort((a, b) => a.index - b.index);
|
||||
@@ -117,9 +117,7 @@ export class InstantiationService implements IInstantiationService {
|
||||
argArray.push(...staticArgs);
|
||||
argArray.push(...serviceArgs);
|
||||
|
||||
const instance = create.apply(null, argArray);
|
||||
desc._validate(instance);
|
||||
return <T>instance;
|
||||
return <T>create.apply(null, argArray);
|
||||
}
|
||||
|
||||
private _getOrCreateServiceInstance<T>(id: ServiceIdentifier<T>): T {
|
||||
|
||||
@@ -39,11 +39,11 @@ export class TestInstantiationService extends InstantiationService {
|
||||
return <T>this._create(service, { mock: true });
|
||||
}
|
||||
|
||||
public stub<T>(service?: ServiceIdentifier<T>, ctor?: any): T
|
||||
public stub<T>(service?: ServiceIdentifier<T>, obj?: any): T
|
||||
public stub<T>(service?: ServiceIdentifier<T>, ctor?: any, property?: string, value?: any): sinon.SinonStub
|
||||
public stub<T>(service?: ServiceIdentifier<T>, obj?: any, property?: string, value?: any): sinon.SinonStub
|
||||
public stub<T>(service?: ServiceIdentifier<T>, property?: string, value?: any): sinon.SinonStub
|
||||
public stub<T>(service?: ServiceIdentifier<T>, ctor?: any): T;
|
||||
public stub<T>(service?: ServiceIdentifier<T>, obj?: any): T;
|
||||
public stub<T>(service?: ServiceIdentifier<T>, ctor?: any, property?: string, value?: any): sinon.SinonStub;
|
||||
public stub<T>(service?: ServiceIdentifier<T>, obj?: any, property?: string, value?: any): sinon.SinonStub;
|
||||
public stub<T>(service?: ServiceIdentifier<T>, property?: string, value?: any): sinon.SinonStub;
|
||||
public stub<T>(serviceIdentifier?: ServiceIdentifier<T>, arg2?: any, arg3?: string, arg4?: any): sinon.SinonStub {
|
||||
let service = typeof arg2 !== 'string' ? arg2 : void 0;
|
||||
let serviceMock: IServiceMock<any> = { id: serviceIdentifier, service: service };
|
||||
@@ -70,10 +70,10 @@ export class TestInstantiationService extends InstantiationService {
|
||||
return stubObject;
|
||||
}
|
||||
|
||||
public stubPromise<T>(service?: ServiceIdentifier<T>, fnProperty?: string, value?: any): T | sinon.SinonStub
|
||||
public stubPromise<T>(service?: ServiceIdentifier<T>, ctor?: any, fnProperty?: string, value?: any): sinon.SinonStub
|
||||
public stubPromise<T>(service?: ServiceIdentifier<T>, obj?: any, fnProperty?: string, value?: any): sinon.SinonStub
|
||||
public stubPromise<T>(arg1?: any, arg2?: any, arg3?: any, arg4?: any): sinon.SinonStub {
|
||||
public stubPromise<T>(service?: ServiceIdentifier<T>, fnProperty?: string, value?: any): T | sinon.SinonStub;
|
||||
public stubPromise<T>(service?: ServiceIdentifier<T>, ctor?: any, fnProperty?: string, value?: any): sinon.SinonStub;
|
||||
public stubPromise<T>(service?: ServiceIdentifier<T>, obj?: any, fnProperty?: string, value?: any): sinon.SinonStub;
|
||||
public stubPromise(arg1?: any, arg2?: any, arg3?: any, arg4?: any): sinon.SinonStub {
|
||||
arg3 = typeof arg2 === 'string' ? TPromise.as(arg3) : arg3;
|
||||
arg4 = typeof arg2 !== 'string' && typeof arg3 === 'string' ? TPromise.as(arg4) : arg4;
|
||||
return this.stub(arg1, arg2, arg3, arg4);
|
||||
@@ -85,9 +85,9 @@ export class TestInstantiationService extends InstantiationService {
|
||||
return spy;
|
||||
}
|
||||
|
||||
private _create<T>(serviceMock: IServiceMock<T>, options: SinonOptions, reset?: boolean): any
|
||||
private _create<T>(ctor: any, options: SinonOptions): any
|
||||
private _create<T>(arg1: any, options: SinonOptions, reset: boolean = false): any {
|
||||
private _create<T>(serviceMock: IServiceMock<T>, options: SinonOptions, reset?: boolean): any;
|
||||
private _create<T>(ctor: any, options: SinonOptions): any;
|
||||
private _create(arg1: any, options: SinonOptions, reset: boolean = false): any {
|
||||
if (this.isServiceMock(arg1)) {
|
||||
let service = this._getOrCreateService(arg1, options, reset);
|
||||
this._serviceCollection.set(arg1.id, service);
|
||||
|
||||
Reference in New Issue
Block a user