Skip to content

[DDC] Evaluating super.field expression in a derived class constructor fails #49943

Open
@annagrin

Description

@annagrin

Repro

  • debug the following dart code
  • set a breakpoint on // Breakpoint here line
  • step in once
  • hover over super.key

Expected: null
Actual: ChromeProxyService: Failed to evaluate expression 'super.key'

Dart code

class View extends SuperView {
  View({super.key}); // Breakpoint here
}

abstract class SuperView {
  const SuperView({this.key});
  final String? key;
}

void main() {
  final View view = View(); // Breakpoint here
  print(view.key);
}

Expression compilation of super.key creates following JS:

 try {
    (function() {
       return super.key;
    }.bind(this)(
    ));
 } catch (error) {
   error.name + ": " + error.message;
 }

Detailed error from chrome proxy service

17:10:15.699 WARNING: ChromeProxyService: Failed to evaluate expression 'super.key'.
17:10:15.699 INFO: ChromeProxyService: Please follow instructions at https://github.com/dart-lang/webdev/issues/956 to file a bug.
17:10:15.700 INFO: ChromeProxyService: Unexpected error from chrome devtools:
text: Uncaught
exception:
  preview: null
  description: SyntaxError: 'super' keyword unexpected here
    at new view.View.new 
...

:#0      Debugger.evaluateJsOnCallFrame (package:dwds/src/debugging/debugger.dart:724:7)
<asynchronous suspension>
#1      StackZoneSpecification._registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:125:47)
<asynchronous suspension>

Metadata

Metadata

Assignees

Labels

P3A lower priority bug or feature requestarea-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.web-dev-compilerweb-evalevaluation support on the web

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions