Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[web] Unexpected token error in profile mode #186

Open
deakjahn opened this issue Jun 28, 2020 · 6 comments
Open

[web] Unexpected token error in profile mode #186

deakjahn opened this issue Jun 28, 2020 · 6 comments

Comments

@deakjahn
Copy link

deakjahn commented Jun 28, 2020

When trying to compile and run my app using sembast in profile mode for the web, I get a strange error message in the browser console:

Uncaught SyntaxError: Unexpected token '|' in line ...

The actual compiled code is:

T.SembastStoreRefExtension_addAll_closure0.prototype = {
  call$1: function(value) {
    return this.client.get$sembastDatabase().sanitizeInputValue$1$1(value, this.V._eval$1("0*"));
  },
  $signature: function() {
    return this.V._eval$1("0*(0*)");
  }
};
T.SembastStoreRefExtension_addAll_closure.prototype = {
  call$1: function(txn) {
    return this.$call$body$SembastStoreRefExtension|addAll_closure(txn);
  },
  $call$body$SembastStoreRefExtension|addAll_closure: function(txn) { //!!!
    var $async$goto = 0,
      $async$completer = P._makeAsyncAwaitCompleter(type$.Null),
      $async$self = this, t2, t3, t4, t5, cur, t1, store, $async$temp1;
    var $async$call$1 = P._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {

The error references the marked line.

It's obviously not your fault :-), just that did you ever experience anything similar? I don't yet know if a minimal, simple app would exhibit the same error.

@deakjahn deakjahn changed the title [web] Tokenin profile mode [web] Unecpected token error in profile mode Jun 28, 2020
@alextekartik
Copy link
Collaborator

Thanks for the report. I have to admit that I never tried profile mode before. I was able to reproduce the issue using the notepad_sembast application on the beta and dev channel.

@deakjahn
Copy link
Author

I don't do it often myself but apart from being able to profile drawing performance issues, there's one huge advantage to profile mode, and this is why I sometimes use it: it compiles to release code but it doesn't minify. And this means that error messages quoting types and variables will make sense. This is actually why I realized it now: I had an exception somewhere (not Sembast-related) and I wanted to be able to understand where it comes from.

Then I'll look into it, too.

@deakjahn deakjahn changed the title [web] Unecpected token error in profile mode [web] Unexpected token error in profile mode Jun 29, 2020
@deakjahn
Copy link
Author

It really looks like the compiler wants to use $call$body$SembastStoreRefExtension|addAll_closure as an identifier, which, frankly, sounds rather fishy. But how come this error doesn't pop up all the time?

@alextekartik
Copy link
Collaborator

Yeap that's weird, I don't speak javascript ;) as fluently as you do. It sounds like we should report this issue to flutter/dart2js. If you do it, great, otherwise I will do it but likely not before next week.

@deakjahn
Copy link
Author

I speak it but I don't like it. :-)) Ok, I'll do it, I'll refer to this issue here.

@alextekartik
Copy link
Collaborator

@deakjahn Thanks for reporting it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants