Open mingodad opened 8 years ago
Adding a return to this declaration silence the error, how to deal with situations like this ?
var handleMessage = (message dynamic) dynamic => {
switch message.type {
case "compile" { return handleCompile(message) }
case "tooltip-query" { return handleTooltipQuery(message) }
case "definition-query" { return handleDefinitionQuery(message) }
case "symbols-query" { return handleSymbolsQuery(message) }
case "rename-query" { return handleRenameQuery(message) }
case "completion-query" { return handleCompletionQuery(message) }
case "signature-query" { return handleSignatureQuery(message) }
default { throw dynamic.Error.new("Unexpected message type '\(message.type)'") }
}
return null //////////////////silence the error
}
This looks like a bug in my control flow analysis. I can fix that bug and in the meantime you can just move the throw statement outside the switch statement to get it to compile.
However, the file jsapi.sk
binds the Skew API to the JavaScript runtime and so is very unlikely to work when cross-compiled to C++. It's sometimes desirable to write Skew bindings to JavaScript in Skew so that the Skew compiler can include that code in the JavaScript minification and other optimizations that the compiler does. This is not the case for the C++ target. Skew's type system cannot express most of the C++ type system, so Skew bindings to C++ are best written in C++. See https://github.com/evanw/sky/blob/master/osx/osx.mm for an example.
Hello ! Trying to compile skew-api to C++ gives this error: