Skip to content

Commit 606a25b

Browse files
authored
Merge pull request #151 from simark/tslint2
Some more tslint rules
2 parents 57afc83 + bed8853 commit 606a25b

File tree

15 files changed

+143
-225
lines changed

15 files changed

+143
-225
lines changed

src/backend/backend.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class VariableObject {
8484
frozen: boolean;
8585
dynamic: boolean;
8686
displayhint: string;
87-
has_more: boolean;
87+
hasMore: boolean;
8888
id: number;
8989
constructor(node: any) {
9090
this.name = MINode.valueOf(node, "name");
@@ -97,7 +97,7 @@ export class VariableObject {
9797
this.dynamic = !!MINode.valueOf(node, "dynamic");
9898
this.displayhint = MINode.valueOf(node, "displayhint");
9999
// TODO: use has_more when it's > 0
100-
this.has_more = !!MINode.valueOf(node, "has_more");
100+
this.hasMore = !!MINode.valueOf(node, "has_more");
101101
}
102102

103103
public applyChanges(node: MINode) {
@@ -107,7 +107,7 @@ export class VariableObject {
107107
}
108108
this.dynamic = !!MINode.valueOf(node, "dynamic");
109109
this.displayhint = MINode.valueOf(node, "displayhint");
110-
this.has_more = !!MINode.valueOf(node, "has_more");
110+
this.hasMore = !!MINode.valueOf(node, "has_more");
111111
}
112112

113113
public isCompound(): boolean {
@@ -133,13 +133,13 @@ export interface MIError extends Error {
133133
readonly name: string;
134134
readonly message: string;
135135
readonly source: string;
136-
};
136+
}
137137
export interface MIErrorConstructor {
138138
new (message: string, source: string): MIError;
139139
readonly prototype: MIError;
140140
}
141141

142-
export const MIError: MIErrorConstructor = <any>class MIError {
142+
export const MIError: MIErrorConstructor = <any> class MIError {
143143
readonly name: string;
144144
readonly message: string;
145145
readonly source: string;

src/backend/gdb_expansion.ts

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MINode } from "./mi_parse"
1+
import { MINode } from "./mi_parse";
22

33
const resultRegex = /^([a-zA-Z_\-][a-zA-Z0-9_\-]*|\[\d+\])\s*=\s*/;
44
const variableRegex = /^[a-zA-Z_\-][a-zA-Z0-9_\-]*/;
@@ -75,8 +75,7 @@ export function expandValue(variableCreate: Function, value: string, root: strin
7575
name = name.substr(1);
7676
}
7777
namespace = namespace + pointerCombineChar + name;
78-
}
79-
else
78+
} else
8079
namespace = name;
8180
}
8281
}
@@ -99,7 +98,7 @@ export function expandValue(variableCreate: Function, value: string, root: strin
9998
value = value.substr(3).trim();
10099
if (value[0] == '}') {
101100
value = value.substr(1).trim();
102-
return <any>"<...>";
101+
return <any> "<...>";
103102
}
104103
}
105104
const eqPos = value.indexOf("=");
@@ -151,45 +150,35 @@ export function expandValue(variableCreate: Function, value: string, root: strin
151150
else if (value.startsWith("true")) {
152151
primitive = "true";
153152
value = value.substr(4).trim();
154-
}
155-
else if (value.startsWith("false")) {
153+
} else if (value.startsWith("false")) {
156154
primitive = "false";
157155
value = value.substr(5).trim();
158-
}
159-
else if (match = nullpointerRegex.exec(value)) {
156+
} else if (match = nullpointerRegex.exec(value)) {
160157
primitive = "<nullptr>";
161158
value = value.substr(match[0].length).trim();
162-
}
163-
else if (match = referenceStringRegex.exec(value)) {
159+
} else if (match = referenceStringRegex.exec(value)) {
164160
value = value.substr(match[1].length).trim();
165161
primitive = parseCString();
166-
}
167-
else if (match = referenceRegex.exec(value)) {
162+
} else if (match = referenceRegex.exec(value)) {
168163
primitive = "*" + match[0];
169164
value = value.substr(match[0].length).trim();
170-
}
171-
else if (match = cppReferenceRegex.exec(value)) {
165+
} else if (match = cppReferenceRegex.exec(value)) {
172166
primitive = match[0];
173167
value = value.substr(match[0].length).trim();
174-
}
175-
else if (match = charRegex.exec(value)) {
168+
} else if (match = charRegex.exec(value)) {
176169
primitive = match[1];
177170
value = value.substr(match[0].length - 1);
178171
primitive += " " + parseCString();
179-
}
180-
else if (match = numberRegex.exec(value)) {
172+
} else if (match = numberRegex.exec(value)) {
181173
primitive = match[0];
182174
value = value.substr(match[0].length).trim();
183-
}
184-
else if (match = variableRegex.exec(value)) {
175+
} else if (match = variableRegex.exec(value)) {
185176
primitive = match[0];
186177
value = value.substr(match[0].length).trim();
187-
}
188-
else if (match = errorRegex.exec(value)) {
178+
} else if (match = errorRegex.exec(value)) {
189179
primitive = match[0];
190180
value = value.substr(match[0].length).trim();
191-
}
192-
else {
181+
} else {
193182
primitive = value;
194183
}
195184
return primitive;
@@ -225,22 +214,18 @@ export function expandValue(variableCreate: Function, value: string, root: strin
225214
if (typeof val == "object") {
226215
ref = variableCreate(val);
227216
val = "Object";
228-
}
229-
else if (typeof val == "string" && val.startsWith("*0x")) {
217+
} else if (typeof val == "string" && val.startsWith("*0x")) {
230218
if (extra && MINode.valueOf(extra, "arg") == "1") {
231219
ref = variableCreate(getNamespace("*(" + name), { arg: true });
232220
val = "<args>";
233-
}
234-
else {
221+
} else {
235222
ref = variableCreate(getNamespace("*" + name));
236223
val = "Object@" + val;
237224
}
238-
}
239-
else if (typeof val == "string" && val.startsWith("@0x")) {
225+
} else if (typeof val == "string" && val.startsWith("@0x")) {
240226
ref = variableCreate(getNamespace("*&" + name.substr));
241227
val = "Ref" + val;
242-
}
243-
else if (typeof val == "string" && val.startsWith("<...>")) {
228+
} else if (typeof val == "string" && val.startsWith("<...>")) {
244229
ref = variableCreate(getNamespace(name));
245230
val = "...";
246231
}
@@ -270,4 +255,4 @@ export function expandValue(variableCreate: Function, value: string, root: strin
270255

271256
value = value.trim();
272257
return parseValue();
273-
}
258+
}

src/backend/linux/console.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as ChildProcess from "child_process"
2-
import * as fs from "fs"
1+
import * as ChildProcess from "child_process";
2+
import * as fs from "fs";
33

44
export function spawnTerminalEmulator(preferedEmulator: string): Thenable<string> {
55
return new Promise((resolve, reject) => {
@@ -18,4 +18,4 @@ export function spawnTerminalEmulator(preferedEmulator: string): Thenable<string
1818
reject();
1919
}, 10);
2020
});
21-
}
21+
}

0 commit comments

Comments
 (0)