If I use caches in my service worker code then Google Closure Compiler (launched with the advanced optimizations mode) will tell me :
/var/www/html/perso/otraSite/web/js/sw_viaTypescript.js:79: ERROR - [JSC_UNDEFINED_VARIABLE] > variable caches is undeclared
})(caches);
^^^^^^
1 error(s), 0 warning(s)
A workaround that I use until now is ... I put window.caches so Google Closure Compiler succeeds to compile but if I let that code, browsers will tell me :
sw.js:18 Uncaught ReferenceError: window is not defined
So I replace window.caches by caches in the code compiled by Google Closure Compiler afterwards but ... having to do this every single time is pretty annoying.
Is there a cleaner way to handle it?
Related
I have some HDF5 C code that I am trying to port to C++Builder. I am getting this error at build time:
[ilink64 Error] Error: Unresolved external 'H5check_version' referenced from D:\DELPHITOOLS\PASHDF\C\WIN64\DEBUG\FILE2.O
H5check_version is included in H5public.h as a macro.
Why does C++Builder not find this?
H5check_version is included in H5public.h as a macro.
If that were true, you would not be getting a linker error, since macros are handled only during the preprocessor stage.
Somewhere in your project, the compiler is seeing a declaration of H5check_version as a function, and your file2 unit is calling it as a function, but the linker can't find the implementation of that function, hence the error.
Your project needs to contain a reference to the appropriate .lib file that either implements the actual function (static linking) or tells the linker which DLL the function is exported from (dynamic linking).
C/C++ is case sensitive, so H5check_version is different from H5Check_version.
AFAIK pascal is not case sensitive at all.
Regards
Compiling Dart app to js these two errors arise:
Nº1:
InvalidStateError: Failed to call 'register' on 'Document' for type 'polymer-element': a type with that name is already registered.
Nº2:
Breaking on exception: TypeError: Object #<qE> has no method 'vL'
The object qE is created by dart2js.
How to find the solution?
There are appropriate tools to find the solution?
Thanks for advance !
I heard N1 occurs when Angular and Polymer is used in the same app. This is a known bug.
related open issues:
- duplicate polymer-element registration should not break the app
- Get error "Uncaught InvalidStateError: Failed to call 'register' on 'Document' for type 'polymer-element'
For the N2 use pub build --mode=debug so you get unmangled names and then use one of the available strategies to fix the problem (use of MirrorsUsed, #observable, #reflectable)
I'm trying to figure out which libraries I need to pass to #MirrorsUsed to get my app compiled and working. Sometimes, it's easy to figure out which library may be missing since a descriptive error is thrown such as Uncaught Unsupported operation: Cannot find class for: NgAttr .
Other times, I get a more obscure message, such as NullError: Cannot call "$gt" on null with no clue as to which library I may be omitting. Is there a better approach to this, besides trial and error?
In case you're wondering, this is an angular app and this is how I currently have it configured:
#MirrorsUsed(targets: const[
'angular',
'angular.core',
'angular.core.dom',
'angular.filter',
'angular.perf',
'angular.directive',
'angular.routing',
'angular.core.parser.dynamic_parser',
'angular.core.parser.lexer',
'todo',
'perf_api',
'List',
'NodeTreeSanitizer',
'PlaybackHttpBackendConfig'
],
override: '*')
import 'dart:mirrors';
Use
pub build --mode=debug
this does tree shaking but retains (mostly) the original Dart names.
Then debugging the generated JavaScript usually lets deduce the source of the exception.
EDIT
IMHO these are not necessary anymore, because they were added to #MirrorsUsed in the Angular libs.
'angular',
'angular.core',
'angular.core.dom',
'angular.filter',
'angular.perf',
'angular.directive',
'angular.routing',
'angular.core.parser.dynamic_parser',
'angular.core.parser.lexer',
Why does the Delphi compiler ignore this missing parenthesis?
function Test: Boolean;
begin
Exit(True; // <-- eek! it compiles...
end;
I found some of my code looking like this and first thought that Delphi ignores my unit - but it just ignores this type of syntax error. So now of course I want to know why.
I'm guessing Exit is considered a token unto itself, and as such anything defined within the same scope after Exit is simply ignored by the compiler (since it cannot execute those instructions anyway).
Maybe the compiler is thinking that either
1. There is an Exit by itself, or
2. There is an Exit with a set of parentheses ().
If it doesn't find #2 it goes to #1.
I'm observing some strange behavior when using the F# interactive interpreter.
Running the following code:
let getType1 = Type.GetType("namespace.does.not.exist, doesntexistlib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",false);;
let getType2 = Type.GetType("namespace.does.not.exist, doesntexistlib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",false);;
results in fsi catching a FileLoadException even though the throwOnError parameter is set to false. The first time it returns a null second time the exception occurs.
Running the same code in a regular program (not interactively) results in expected behavior where getType = null.
Does FSI.exe stop on all exceptions? Is it possible to set FSI to ignore these exceptions?
Based on the stack trace, it looks like FSI is hooking into its AppDomain's assembly resolution. Unfortunately FSI is throwing the exception itself when it can't resolve the assembly - this isn't being generated by framework code, and that's why your throwOnError parameter isn't being respected - FSI's exception is just propagating upwards and then being caught at the top level. To me, this looks like a bug in FSI, but it may be that the available hooks in the AppDomain's assembly resolution process don't provide FSI with enough information to determine when it's okay to throw.
EDIT - If you look into the source file fsi.fs (included in the F# distribution in the source/fsharp/Fsi directory), you can see where this handler is hooked up (it's in the frighteningly named MagicAssemblyResolution module). It appears that FSI needs to hook into the resolution process so that assemblies registered via the #r directive can be found, but I can't tell at a glance where things are going wrong, or why no exception is thrown all the way to the top level the first time you try to resolve an invalid assembly.