Skip to content

Some functions have -1 as their end token positions #32315

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

Open
chloestefantsova opened this issue Feb 26, 2018 · 4 comments
Open

Some functions have -1 as their end token positions #32315

chloestefantsova opened this issue Feb 26, 2018 · 4 comments
Labels
front-end-fasta legacy-area-front-end Legacy: Use area-dart-model instead.

Comments

@chloestefantsova
Copy link
Contributor

It is visible in the VM when the coverage report data is printed for those functions. One of such functions is replaceRange for some classes.

CL 43720 is written to mitigate the impact for the VM.

@chloestefantsova chloestefantsova added front-end-fasta legacy-area-front-end Legacy: Use area-dart-model instead. labels Feb 26, 2018
@peter-ahe-google
Copy link
Contributor

Do you have an example of such a function?

@chloestefantsova
Copy link
Contributor Author

Sorry I didn't provide the examples and the repro steps. I needed the issue number to refer to from the code (I'm currently fixing #32282). Currently I know the name of one of such functions. I've got it from a debug session when I printed out the names of the functions. I'm not sure what class it is from, though. I'll come back soon with concrete examples and repro steps.

@jensjoha
Copy link
Contributor

At least when compiling the sdk, they all come from forwarding stubs, and the following fixes it:

diff --git a/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart b/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
index be842cf29d..4b91c19f30 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
@@ -480,6 +480,7 @@ class ForwardingNode extends Procedure {
         fileUri: enclosingClass.fileUri,
         forwardingStubInterfaceTarget: finalTarget)
       ..fileOffset = enclosingClass.fileOffset
+      ..fileEndOffset = enclosingClass.fileOffset
       ..parent = enclosingClass
       ..isGenericContravariant = target.isGenericContravariant;
   }

I'm, not quite sure the offsets make sense though...

@jensjoha
Copy link
Contributor

Fields also contain endOffsets, and doesn't (at least always) have them. In the VM they are used to set the end offsets for setters and getters and to setup scopes (when the field has an initializer).

Also, not all constructors have an endOffset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
front-end-fasta legacy-area-front-end Legacy: Use area-dart-model instead.
Projects
None yet
Development

No branches or pull requests

3 participants