mirror of
https://github.com/open-goal/opengoal-vscode.git
synced 2024-10-20 12:57:36 -04:00
casts: forbid empty string casts (#160)
This commit is contained in:
parent
ab5efa2ade
commit
b23a8cc257
|
@ -129,7 +129,7 @@ async function labelCastSelection() {
|
||||||
const castToType = await vscode.window.showInputBox({
|
const castToType = await vscode.window.showInputBox({
|
||||||
title: "Cast to Type?",
|
title: "Cast to Type?",
|
||||||
});
|
});
|
||||||
if (castToType === undefined) {
|
if (castToType === undefined || castToType.trim() === "") {
|
||||||
await vscode.window.showErrorMessage("Can't cast if no type is provided");
|
await vscode.window.showErrorMessage("Can't cast if no type is provided");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,13 @@ async function labelCastSelection() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finally, do the cast!
|
// Finally, do the cast!
|
||||||
await applyLabelCast(editor, objectName, labelRef, castToType, pointerSize);
|
await applyLabelCast(
|
||||||
|
editor,
|
||||||
|
objectName,
|
||||||
|
labelRef,
|
||||||
|
castToType.trim(),
|
||||||
|
pointerSize
|
||||||
|
);
|
||||||
|
|
||||||
lastCastKind = CastKind.Label;
|
lastCastKind = CastKind.Label;
|
||||||
lastLabelCastType = castToType;
|
lastLabelCastType = castToType;
|
||||||
|
@ -214,13 +220,13 @@ async function stackCastSelection() {
|
||||||
const castToType = await vscode.window.showInputBox({
|
const castToType = await vscode.window.showInputBox({
|
||||||
title: "Cast to Type?",
|
title: "Cast to Type?",
|
||||||
});
|
});
|
||||||
if (castToType === undefined) {
|
if (castToType === undefined || castToType.trim() === "") {
|
||||||
await vscode.window.showErrorMessage("Can't cast if no type is provided");
|
await vscode.window.showErrorMessage("Can't cast if no type is provided");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finally, do the cast!
|
// Finally, do the cast!
|
||||||
await applyStackCast(editor, funcName, stackOffset, castToType);
|
await applyStackCast(editor, funcName, stackOffset, castToType.trim());
|
||||||
|
|
||||||
lastCastKind = CastKind.Stack;
|
lastCastKind = CastKind.Stack;
|
||||||
lastStackCastType = castToType;
|
lastStackCastType = castToType;
|
||||||
|
@ -338,7 +344,7 @@ async function typeCastSelection() {
|
||||||
const castToType = await vscode.window.showInputBox({
|
const castToType = await vscode.window.showInputBox({
|
||||||
title: "Cast to Type?",
|
title: "Cast to Type?",
|
||||||
});
|
});
|
||||||
if (castToType === undefined) {
|
if (castToType === undefined || castToType.trim() === "") {
|
||||||
await vscode.window.showErrorMessage("Can't cast if no type is provided");
|
await vscode.window.showErrorMessage("Can't cast if no type is provided");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -349,7 +355,7 @@ async function typeCastSelection() {
|
||||||
funcName,
|
funcName,
|
||||||
castContext,
|
castContext,
|
||||||
registerSelection,
|
registerSelection,
|
||||||
castToType
|
castToType.trim()
|
||||||
);
|
);
|
||||||
|
|
||||||
lastCastKind = CastKind.TypeCast;
|
lastCastKind = CastKind.TypeCast;
|
||||||
|
|
Loading…
Reference in a new issue