Skip to content

Commit

Permalink
Normalize scope leak blocks in switch statements
Browse files Browse the repository at this point in the history
  • Loading branch information
timkurvers committed May 24, 2020
1 parent cf1eff6 commit d5c186d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/ui/Context.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ class UIContext {
} else {
status.error("element 'Include' without file attribute");
}
} break;

break;
}
case 'script': {
const file = attributes.get('file');
if (file) {
Expand All @@ -161,12 +161,12 @@ class UIContext {
} else if (body) {
this.scripting.execute(body, `${filePath}:<Scripts>`);
}
} break;

break;
}
case 'font': {
// TODO: Font support
} break;

break;
}
// Other frame nodes
default: {
const name = attributes.get('name');
Expand Down
9 changes: 6 additions & 3 deletions src/ui/components/Backdrop.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,21 @@ class Backdrop {
for (const child of node.children) {
const iname = child.name.toLowerCase();
switch (iname) {
case 'tilesize':
case 'tilesize': {
const backgroundSize = extractValueFrom(child);
if (backgroundSize !== undefined) {
this.backgroundSize = backgroundSize;
}
break;
case 'edgesize':
}
case 'edgesize': {
const edgeSize = extractValueFrom(child);
if (edgeSize !== undefined) {
this.edgeSize = edgeSize;
}
break;
case 'backgroundinsets':
}
case 'backgroundinsets': {
const insets = extractInsetsFrom(child);
if (insets.left !== undefined) {
this.leftInset = insets.left;
Expand All @@ -82,6 +84,7 @@ class Backdrop {
this.bottomInset = insets.bottom;
}
break;
}
// TODO: Color & border color
}
}
Expand Down
12 changes: 8 additions & 4 deletions src/ui/components/simple/Button/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,24 @@ class Button extends Frame {
case 'normaltexture': {
const texture = ui.createTexture(child, this);
this.setStateTexture(ButtonState.NORMAL, texture);
} break;
break;
}
case 'pushedtexture': {
const texture = ui.createTexture(child, this);
this.setStateTexture(ButtonState.PUSHED, texture);
} break;
break;
}
case 'disabledtexture': {
const texture = ui.createTexture(child, this);
this.setStateTexture(ButtonState.DISABLED, texture);
} break;
break;
}
case 'highlighttexture': {
const texture = ui.createTexture(child, this);
// TODO: Blend mode
this.setHighlight(texture, null);
} break;
break;
}
case 'buttontext':
ui.createFontString(child, this);
// TODO: Reference above font string on this button
Expand Down

0 comments on commit d5c186d

Please sign in to comment.