Skip to content

Fix DDC compilation error for the Dart Debug Extension #1594

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

Merged
merged 6 commits into from
May 5, 2022

Conversation

elliette
Copy link
Contributor

@elliette elliette commented May 2, 2022

Fixes #1506

Explicitly casts our tab list (which the compiler thought was List<dynamic>) to List<Tab>.

This is a known limitation of the Dart JS package (https://github.com/dart-lang/sdk/tree/master/pkg/js#list-instances-coming-from-javascript-will-always-be-listdynamic).

@elliette elliette requested a review from annagrin May 2, 2022 23:44
attachDebuggerToTab(tabs[0]);
queryTabs(getCurrentTabQuery, allowInterop((List tabs) {
final tabList = List<Tab>.from(tabs);
if (tabList != null && tabList.isNotEmpty) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tabList will never be null here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good point!

if (tabs != null && tabs.isNotEmpty) {
attachDebuggerToTab(tabs[0]);
queryTabs(getCurrentTabQuery, allowInterop((List tabs) {
final tabList = List<Tab>.from(tabs);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we only ever us the first tab, do we need to create the full list for multiple tabs?

  if (tabs.isNotEmpty) {
    attachDebuggerToTab(tabList.first as Tab);
  }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, done!

Also discovered a few other type errors when compiled with DDC, so I've fixed those as well.

@@ -363,7 +364,8 @@ void _forwardMessageToExternalExtensions(
}

void _notifyPanelScriptOfChanges(List<DevToolsPanel> panels) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
void _notifyPanelScriptOfChanges(List<DevToolsPanel> panels) {
void _notifyPanelScriptOfChanges(List panels) {

@elliette elliette merged commit 049a8b8 into dart-lang:master May 5, 2022
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

Successfully merging this pull request may close these issues.

Error thrown when Dart Debug Extension is compiled with DDC
2 participants