Skip to content

Commit

Permalink
Merge pull request #11546 from keymanapp/fix/developer/11545-nomatch-…
Browse files Browse the repository at this point in the history
…return-causes-exception

fix(developer): handle unsupported `return` statement in `match` and `nomatch` in web compiler
  • Loading branch information
mcdurdin authored May 30, 2024
2 parents a013255 + 67484cb commit 8495406
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ export function JavaScript_OutputString(fk: KMX.KEYBOARD, FTabStops: string, fkp
len = -1;
break;
default:
callbacks.reportMessage(KmwCompilerMessages.Error_NotSupportedInKeymanWebOutput({line: fkp.Line, code: GetCodeName(rec.Code)}));
callbacks.reportMessage(KmwCompilerMessages.Error_NotSupportedInKeymanWebOutput({line: fkp?.Line ?? 0, code: GetCodeName(rec.Code)}));
Result += '';
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
store(&VERSION) '9.0'
store(&NAME) 'error_not_supported_in_keyman_web_output'
store(&TARGETS) 'web'

begin Unicode > use(main)

group(main) using keys

c `return` is supported only in KMX; see also #11545
nomatch > return
7 changes: 7 additions & 0 deletions developer/src/kmc-kmn/test/kmw/test-kmw-messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,11 @@ describe('KmwCompilerMessages', function () {
// await testForMessage(this, ['kmw', '....kmn'], KmwCompilerMessages.ERROR_TouchLayoutFileDoesNotExist);
// });

// ERROR_NotSupportedInKeymanWebOutput

it('should generate ERROR_NotSupportedInKeymanWebOutput if the command is not supported in output for KeymanWeb', async function() {
await testForMessage(this, ['kmw', 'error_not_supported_in_keyman_web_output.kmn'], KmwCompilerMessages.ERROR_NotSupportedInKeymanWebOutput);
});


});

0 comments on commit 8495406

Please sign in to comment.