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

VM doesn't allow to access external globals from within the same library. #6997

Closed
floitschG opened this issue Nov 28, 2012 · 3 comments
Closed
Assignees
Labels
area-vm closed-cannot-reproduce Closed as we were unable to reproduce the reported issue closed-obsolete Closed as the reported issue is no longer relevant

Comments

@floitschG
Copy link
Contributor

The VM doesn't allow to access external globals from within the same library. For example adding a port2 getter that just redirects to the external port getter will fail:

$ out/ReleaseIA32/dart bug.dart
Instance of '_ReceivePortImpl@0x2a486688'
Unhandled exception:
No such method: 'get:port', url 'dart:isolate' line 7 pos 30
external ReceivePort get port;

­0 NoSuchMethodErrorImplementation._throwNew (dart:core-patch:633:3)

­1 port (dart:isolate:7:30)

­2 port2 (dart:isolate:8:26)

­3 main (file:///tmp/t.dart:5:9)

===
diff --git a/sdk/lib/isolate/base.dart b/sdk/lib/isolate/base.dart
index e43e3bb..339aebb 100644

--- a/sdk/lib/isolate/base.dart
+++ b/sdk/lib/isolate/base.dart
@@ -15,6 +15,7 @­@ class IsolateSpawnException implements Exception {
  * [spawnUri]).
  /
 external ReceivePort get port;
+ReceivePort get port2 => port;
 
 /**
  
Creates and spawns an isolate that shares the same code as the current

@iposva-google
Copy link
Contributor

Set owner to @iposva-google.
Added Accepted label.

@iposva-google
Copy link
Contributor

Removed Priority-Medium label.
Added Priority-Unassigned label.

@whesse
Copy link
Member

whesse commented Oct 25, 2013

When I had

external _Platform get _platform;

int get numProcessors => _platform.numProcessors;
_Platform get foo => _platform;

in platform.dart, then (when patched with a getter) the second use, just returning _platform, works, but the first use (_platform.numProcessors) gives an error at runtime (method not found).
It is trying to find _Platform _platform(...) but finds _Platform _platform().
Something about using the patched function in expressions causes the wrong code to be created.

@mhausner mhausner added closed-obsolete Closed as the reported issue is no longer relevant closed-cannot-reproduce Closed as we were unable to reproduce the reported issue labels Jan 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm closed-cannot-reproduce Closed as we were unable to reproduce the reported issue closed-obsolete Closed as the reported issue is no longer relevant
Projects
None yet
Development

No branches or pull requests

4 participants