提交 428eac30 编写于 作者: M Matt Bierner

Adding a few more files to strict null checks

上级 c61e9ecc
......@@ -28,18 +28,19 @@
"./vs/base/common/decorators.ts",
"./vs/base/common/diff/diff.ts",
"./vs/base/common/diff/diffChange.ts",
"./vs/base/common/history.ts",
"./vs/base/common/errors.ts",
"./vs/base/common/event.ts",
"./vs/base/common/functional.ts",
"./vs/base/common/glob.ts",
"./vs/base/common/hash.ts",
"./vs/base/common/history.ts",
"./vs/base/common/htmlContent.ts",
"./vs/base/common/idGenerator.ts",
"./vs/base/common/iterator.ts",
"./vs/base/common/jsonSchema.ts",
"./vs/base/common/keybindingParser.ts",
"./vs/base/common/keyCodes.ts",
"./vs/base/common/keybindingParser.ts",
"./vs/base/common/labels.ts",
"./vs/base/common/lifecycle.ts",
"./vs/base/common/linkedList.ts",
"./vs/base/common/map.ts",
......@@ -59,7 +60,6 @@
"./vs/base/common/severity.ts",
"./vs/base/common/stopwatch.ts",
"./vs/base/common/strings.ts",
"./vs/base/common/labels.ts",
"./vs/base/common/types.ts",
"./vs/base/common/uri.ts",
"./vs/base/common/uriIpc.ts",
......@@ -67,6 +67,7 @@
"./vs/base/common/uuid.ts",
"./vs/base/common/winjs.base.d.ts",
"./vs/base/common/worker/simpleWorker.ts",
"./vs/base/node/decoder.ts",
"./vs/base/node/paths.ts",
"./vs/base/node/ports.ts",
"./vs/base/parts/contextmenu/common/contextmenu.ts",
......@@ -75,6 +76,10 @@
"./vs/base/test/node/uri.test.perf.ts",
"./vs/base/worker/defaultWorkerFactory.ts",
"./vs/base/worker/workerMain.ts",
"./vs/code/electron-browser/issue/issueReporterPage.ts",
"./vs/code/electron-browser/issue/issueReporterUtil.ts",
"./vs/code/electron-main/theme.ts",
"./vs/code/node/shellEnv.ts",
"./vs/editor/common/config/editorZoom.ts",
"./vs/editor/common/controller/cursorEvents.ts",
"./vs/editor/common/controller/wordCharacterClassifier.ts",
......@@ -109,10 +114,12 @@
"./vs/platform/files/node/files.ts",
"./vs/platform/instantiation/common/descriptors.ts",
"./vs/platform/instantiation/common/extensions.ts",
"./vs/platform/instantiation/common/graph.ts",
"./vs/platform/instantiation/common/instantiation.ts",
"./vs/platform/instantiation/common/serviceCollection.ts",
"./vs/platform/integrity/common/integrity.ts",
"./vs/platform/markers/common/markers.ts",
"./vs/platform/node/minimalTranslations.ts",
"./vs/platform/node/package.ts",
"./vs/platform/node/product.ts",
"./vs/platform/opener/common/opener.ts",
......@@ -124,6 +131,7 @@
"./vs/workbench/parts/execution/common/execution.ts",
"./vs/workbench/parts/logs/common/logConstants.ts",
"./vs/workbench/parts/terminal/browser/terminalWidgetManager.ts",
"./vs/workbench/parts/welcome/page/electron-browser/vs_code_welcome_page.ts",
"./vs/workbench/services/activity/common/activity.ts",
"./vs/workbench/services/configuration/common/jsonEditing.ts",
"./vs/workbench/services/extensions/node/lazyPromise.ts",
......@@ -136,4 +144,4 @@
"exclude": [
"./typings/require-monaco.d.ts"
]
}
}
\ No newline at end of file
......@@ -60,7 +60,7 @@ export function shift({ start, end }: IRange, much: number): IRange {
*/
export function consolidate(groups: IRangedGroup[]): IRangedGroup[] {
const result: IRangedGroup[] = [];
let previousGroup: IRangedGroup = null;
let previousGroup: IRangedGroup | null = null;
for (let group of groups) {
const start = group.range.start;
......
......@@ -88,7 +88,7 @@ export function trim(haystack: string, needle: string = ' '): string | undefined
* @param haystack string to trim
* @param needle the thing to trim
*/
export function ltrim(haystack?: string, needle?: string): string | undefined {
export function ltrim(haystack: string, needle: string): string {
if (!haystack || !needle) {
return haystack;
}
......@@ -111,7 +111,7 @@ export function ltrim(haystack?: string, needle?: string): string | undefined {
* @param haystack string to trim
* @param needle the thing to trim
*/
export function rtrim(haystack?: string, needle?: string): string | undefined {
export function rtrim(haystack: string, needle: string): string {
if (!haystack || !needle) {
return haystack;
}
......
......@@ -16,7 +16,7 @@ import { CharCode } from 'vs/base/common/charCode';
*/
export class LineDecoder {
private stringDecoder: sd.NodeStringDecoder;
private remaining: string;
private remaining: string | null;
constructor(encoding: string = 'utf8') {
this.stringDecoder = new sd.StringDecoder(encoding);
......@@ -56,7 +56,7 @@ export class LineDecoder {
return result;
}
public end(): string {
public end(): string | null {
return this.remaining;
}
}
\ No newline at end of file
......@@ -19,7 +19,7 @@ export function getBackgroundColor(stateService: IStateService): string {
return DEFAULT_BG_HC_BLACK;
}
let background = stateService.getItem<string>(THEME_BG_STORAGE_KEY, null);
let background = stateService.getItem<string | null>(THEME_BG_STORAGE_KEY, null);
if (!background) {
let baseTheme: string;
if (isWindows && systemPreferences.isInvertedColorScheme()) {
......
......@@ -21,7 +21,7 @@ function getUnixShellEnvironment(): Promise<typeof process.env> {
});
const command = `'${process.execPath}' -p '"${mark}" + JSON.stringify(process.env) + "${mark}"'`;
const child = cp.spawn(process.env.SHELL, ['-ilc', command], {
const child = cp.spawn(process.env.SHELL!, ['-ilc', command], {
detached: true,
stdio: ['ignore', 'pipe', process.stderr],
env
......@@ -66,7 +66,7 @@ function getUnixShellEnvironment(): Promise<typeof process.env> {
});
// swallow errors
return promise.then(null, () => ({}));
return promise.then(undefined, () => ({}));
}
......
......@@ -238,7 +238,7 @@ export class ModelRawContentChangedEvent {
}
public static merge(a: ModelRawContentChangedEvent, b: ModelRawContentChangedEvent): ModelRawContentChangedEvent {
const changes = (<ModelRawChange[]>[]).concat(a.changes).concat(b.changes);
const changes = ([] as ModelRawChange[]).concat(a.changes).concat(b.changes);
const versionId = b.versionId;
const isUndoing = (a.isUndoing || b.isUndoing);
const isRedoing = (a.isRedoing || b.isRedoing);
......@@ -262,7 +262,7 @@ export class InternalModelContentChangeEvent {
}
private static _mergeChangeEvents(a: IModelContentChangedEvent, b: IModelContentChangedEvent): IModelContentChangedEvent {
const changes = (<IModelContentChange[]>[]).concat(a.changes).concat(b.changes);
const changes = ([] as IModelContentChange[]).concat(a.changes).concat(b.changes);
const eol = b.eol;
const versionId = b.versionId;
const isUndoing = (a.isUndoing || b.isUndoing);
......
......@@ -178,7 +178,8 @@ export function substituteMatches(lexer: ILexerMin, str: string, id: string, mat
/**
* Find the tokenizer rules for a specific state (i.e. next action)
*/
export function findRules(lexer: ILexer, state: string | null): IRule[] | null {
export function findRules(lexer: ILexer, inState: string): IRule[] | null {
let state: string | null = inState;
while (state && state.length > 0) {
const rules = lexer.tokenizer[state];
if (rules) {
......@@ -200,7 +201,8 @@ export function findRules(lexer: ILexer, state: string | null): IRule[] | null {
* This is used during compilation where we may know the defined states
* but not yet whether the corresponding rules are correct.
*/
export function stateExists(lexer: ILexerMin, state: string | null): boolean {
export function stateExists(lexer: ILexerMin, inState: string): boolean {
let state: string | null = inState;
while (state && state.length > 0) {
const exist = lexer.stateNames[state];
if (exist) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册