Skip to content

On variable drill down, inherited fields are not visible #1263

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

Closed
vsmenon opened this issue Mar 7, 2021 · 4 comments
Closed

On variable drill down, inherited fields are not visible #1263

vsmenon opened this issue Mar 7, 2021 · 4 comments
Assignees

Comments

@vsmenon
Copy link
Member

vsmenon commented Mar 7, 2021

In the variables window here, this is of type PageController. When I expand, I see fields defined directly in that class. I don't see fields inherited from the superclass, ScrollController (e.g., _initialScrollOffset or keepScrollOffset):

Screen Shot 2021-03-06 at 1 13 13 PM

This is with:

> flutter --version
Flutter 2.0.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision c5a4b4029c (3 days ago) • 2021-03-04 09:47:48 -0800
Engine • revision 40441def69
Tools • Dart 2.12.0

FYI - @annagrin @grouma - not sure how pervasive this is, but I think fairly high priority if so.

@vsmenon
Copy link
Member Author

vsmenon commented Mar 7, 2021

Screen Shot 2021-03-07 at 9 59 00 AM

This is one level up in the stack. In this case, this is a subclass of State, and I similarly cannot see fields from State:

https://github.com/flutter/flutter/blob/e5322acc77f116803c93cfe1d538ae3c16a19423/packages/flutter/lib/src/widgets/framework.dart#L884

@annagrin
Copy link
Contributor

annagrin commented Mar 9, 2021

I don't see the same outcome - I wonder if this is could be related to dart-lang/sdk#45266.
I am currently working on the fix.

@annagrin
Copy link
Contributor

annagrin commented Mar 19, 2021

I created a smaller repro - apparently evaluation works fine, but local variables returned from dwds do not contain inherited fields - note that watch window and expression evaluation box evaluate b.t but it does not appear in local variables view.

We currently use ddc runtime function sdk_utils.getFields to get the fields of the object (this in code below), and it does not seem to list all the inherited properties. Note the comment: // TODO(alanknight): Handle superclass fields.:

final fieldNameExpression = '''function() {

Suggestion:

  • Add getting all fields functionality to the ddc runtime
  • Add a more concise way for a debugger to ask for fields of an object
  • If possible, it should use dart evaluation instead of js evaluation
    • Can we create dart ddc runtime library that the debugger can use?
    • Another option could be reflection but it seems that dart:mirrors are not supported on flutter and I am not sure it works on web: Allow using dart:mirrors flutter/flutter#1150

code example:

class A {
  A(this.t);
  int t;
}

class B extends A {
  B(this.p): super(p+1);
  int p;

  void foo() {
    print('in foo');
  }
}

void main() {

  B b = B(0);
  A a = A(42);

  b.foo();
}

image

@annagrin
Copy link
Contributor

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