You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using dart to create some binary file reader in browser. So, i wrote code, that works with dart:typed_data.ByteData, it uses Uint8List as data keeper and ByteData as raw data converter.
The code i wrote perfectly works on Dartium, but when i've tried to execute dart2js compiled code in Chrome 28.0.1500.95 m (Win7 x64), i've meet up some troubles.
What steps will reproduce the problem?
0. Open in
We have a fullfilled Uint8List Reader._base;
Client code triyng to execute Reader.readInt()
int readInt(){
assert(!this.eof);
ByteBuffer bb = this._base.buffer;
ByteData bd = new ByteData.view(bb, this._pos, 4);
assert(bd != null);
this._seekPos(this._pos+4);
return bd.getInt32(0, this._endian);
}
The VM and dart2js implementations are slightly inconsistent.
See Issue #10136.
I suspect that your program has a small bug but works in the VM because a single object (your buffer/list) implements both interfaces: Uint8List and ByteBuffer.
On dart2js these are always separate types - no browser object implements both interfaces.
My guess is that Reader._base is actually initialized to a ByteBuffer. On the VM this does not matter because it is also a Uint8List.
If you compile dart2js in checked mode you should get an exception at the initialization of '_base'.
Or you could try to print the type: print(this._base.buffer.runtimeType);
Because the VM Uint8List is also a ByteBuffer, running on the VM did not help you find this bug.
If my guess is correct I would like to close this bug as a duplicate of Issue #10136.
This issue was originally filed by [email protected]
I'm using dart to create some binary file reader in browser. So, i wrote code, that works with dart:typed_data.ByteData, it uses Uint8List as data keeper and ByteData as raw data converter.
The code i wrote perfectly works on Dartium, but when i've tried to execute dart2js compiled code in Chrome 28.0.1500.95 m (Win7 x64), i've meet up some troubles.
What steps will reproduce the problem?
0. Open in
int readInt(){
assert(!this.eof);
ByteBuffer bb = this._base.buffer;
ByteData bd = new ByteData.view(bb, this._pos, 4);
assert(bd != null);
this._seekPos(this._pos+4);
return bd.getInt32(0, this._endian);
}
Uncaught Error: NoSuchMethodError : method not found: 'Object #<ByteBuffer> has no method 'get$buffer''
Receiver: ""
Arguments: []
Stack Trace:
TypeError: Object #<ByteBuffer> has no method 'get$buffer'
at $.get$buffer$x (http://127.0.0.1:3030/D:/dev/tmp/repos/odc/odc/web/odc.dart.js:73305:39)
at Reader.readInt$0 (http://127.0.0.1:3030/D:/dev/tmp/repos/odc/odc/web/odc.dart.js:65194:41)
at Documents_importDocument (http://127.0.0.1:3030/D:/dev/tmp/repos/odc/odc/web/odc.dart.js:63395:12)
The text was updated successfully, but these errors were encountered: