Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(622)

Unified Diff: lib/runtime/dart/_native_typed_data.js

Issue 1093143004: fixes #52, fields shadowing getters/setters or other fields (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/runtime/dart/_js_helper.js ('k') | lib/runtime/dart/async.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/runtime/dart/_native_typed_data.js
diff --git a/lib/runtime/dart/_native_typed_data.js b/lib/runtime/dart/_native_typed_data.js
index 4c9290b64c65b270c06640e4ccf0274e0203fb17..923f5147236d6233d8c2f8f904ed0f23c0fe760a 100644
--- a/lib/runtime/dart/_native_typed_data.js
+++ b/lib/runtime/dart/_native_typed_data.js
@@ -4,7 +4,7 @@ var _native_typed_data;
let _externalStorage = Symbol('_externalStorage');
class NativeByteBuffer extends core.Object {
NativeByteBuffer() {
- this.lengthInBytes = null;
+ dart.initField(NativeByteBuffer, this, 'lengthInBytes', null);
}
get runtimeType() {
return typed_data.ByteBuffer;
@@ -397,10 +397,10 @@ var _native_typed_data;
dart.defineNamedConstructor(NativeFloat64x2List, 'fromList');
class NativeTypedData extends core.Object {
NativeTypedData() {
- this.buffer = null;
- this.lengthInBytes = null;
- this.offsetInBytes = null;
- this.elementSizeInBytes = null;
+ dart.initField(NativeTypedData, this, 'buffer', null);
+ dart.initField(NativeTypedData, this, 'lengthInBytes', null);
+ dart.initField(NativeTypedData, this, 'offsetInBytes', null);
+ dart.initField(NativeTypedData, this, 'elementSizeInBytes', null);
}
[_invalidIndex](index, length) {
if (dart.notNull(index) < 0 || dart.notNull(index) >= dart.notNull(length)) {
@@ -431,6 +431,7 @@ var _native_typed_data;
}
}
NativeTypedData[dart.implements] = () => [typed_data.TypedData];
+ dart.virtualField(NativeTypedData, 'elementSizeInBytes');
// Function _checkLength: (dynamic) → int
function _checkLength(length) {
if (!(typeof length == 'number'))
@@ -990,10 +991,10 @@ var _native_typed_data;
return NativeFloat32x4[_list][core.$get](0);
}
NativeFloat32x4(x, y, z, w) {
- this.x = dart.as(NativeFloat32x4[_truncate](x), core.double);
- this.y = dart.as(NativeFloat32x4[_truncate](y), core.double);
- this.z = dart.as(NativeFloat32x4[_truncate](z), core.double);
- this.w = dart.as(NativeFloat32x4[_truncate](w), core.double);
+ dart.initField(NativeFloat32x4, this, 'x', dart.as(NativeFloat32x4[_truncate](x), core.double));
+ dart.initField(NativeFloat32x4, this, 'y', dart.as(NativeFloat32x4[_truncate](y), core.double));
+ dart.initField(NativeFloat32x4, this, 'z', dart.as(NativeFloat32x4[_truncate](z), core.double));
+ dart.initField(NativeFloat32x4, this, 'w', dart.as(NativeFloat32x4[_truncate](w), core.double));
if (!dart.is(x, core.num))
throw new core.ArgumentError(x);
if (!dart.is(y, core.num))
@@ -1020,16 +1021,16 @@ var _native_typed_data;
this[_truncated](dart.as(NativeFloat32x4[_truncate](v.x), core.double), dart.as(NativeFloat32x4[_truncate](v.y), core.double), 0.0, 0.0);
}
[_doubles](x, y, z, w) {
- this.x = dart.as(NativeFloat32x4[_truncate](x), core.double);
- this.y = dart.as(NativeFloat32x4[_truncate](y), core.double);
- this.z = dart.as(NativeFloat32x4[_truncate](z), core.double);
- this.w = dart.as(NativeFloat32x4[_truncate](w), core.double);
+ dart.initField(NativeFloat32x4, this, 'x', dart.as(NativeFloat32x4[_truncate](x), core.double));
+ dart.initField(NativeFloat32x4, this, 'y', dart.as(NativeFloat32x4[_truncate](y), core.double));
+ dart.initField(NativeFloat32x4, this, 'z', dart.as(NativeFloat32x4[_truncate](z), core.double));
+ dart.initField(NativeFloat32x4, this, 'w', dart.as(NativeFloat32x4[_truncate](w), core.double));
}
[_truncated](x, y, z, w) {
- this.x = x;
- this.y = y;
- this.z = z;
- this.w = w;
+ dart.initField(NativeFloat32x4, this, 'x', x);
+ dart.initField(NativeFloat32x4, this, 'y', y);
+ dart.initField(NativeFloat32x4, this, 'z', z);
+ dart.initField(NativeFloat32x4, this, 'w', w);
}
toString() {
return `[${this.x}, ${this.y}, ${this.z}, ${this.w}]`;
@@ -1258,10 +1259,10 @@ var _native_typed_data;
return NativeInt32x4[_list][core.$get](0);
}
NativeInt32x4(x, y, z, w) {
- this.x = dart.as(NativeInt32x4[_truncate](x), core.int);
- this.y = dart.as(NativeInt32x4[_truncate](y), core.int);
- this.z = dart.as(NativeInt32x4[_truncate](z), core.int);
- this.w = dart.as(NativeInt32x4[_truncate](w), core.int);
+ dart.initField(NativeInt32x4, this, 'x', dart.as(NativeInt32x4[_truncate](x), core.int));
+ dart.initField(NativeInt32x4, this, 'y', dart.as(NativeInt32x4[_truncate](y), core.int));
+ dart.initField(NativeInt32x4, this, 'z', dart.as(NativeInt32x4[_truncate](z), core.int));
+ dart.initField(NativeInt32x4, this, 'w', dart.as(NativeInt32x4[_truncate](w), core.int));
if (x != this.x && !(typeof x == 'number'))
throw new core.ArgumentError(x);
if (y != this.y && !(typeof y == 'number'))
@@ -1272,10 +1273,10 @@ var _native_typed_data;
throw new core.ArgumentError(w);
}
bool(x, y, z, w) {
- this.x = x ? -1 : 0;
- this.y = y ? -1 : 0;
- this.z = z ? -1 : 0;
- this.w = w ? -1 : 0;
+ dart.initField(NativeInt32x4, this, 'x', x ? -1 : 0);
+ dart.initField(NativeInt32x4, this, 'y', y ? -1 : 0);
+ dart.initField(NativeInt32x4, this, 'z', z ? -1 : 0);
+ dart.initField(NativeInt32x4, this, 'w', w ? -1 : 0);
}
fromFloat32x4Bits(f) {
let floatList = NativeFloat32x4[_list];
@@ -1287,10 +1288,10 @@ var _native_typed_data;
return new NativeInt32x4[_truncated](view[core.$get](0), view[core.$get](1), view[core.$get](2), view[core.$get](3));
}
[_truncated](x, y, z, w) {
- this.x = x;
- this.y = y;
- this.z = z;
- this.w = w;
+ dart.initField(NativeInt32x4, this, 'x', x);
+ dart.initField(NativeInt32x4, this, 'y', y);
+ dart.initField(NativeInt32x4, this, 'z', z);
+ dart.initField(NativeInt32x4, this, 'w', w);
}
toString() {
return `[${this.x}, ${this.y}, ${this.z}, ${this.w}]`;
@@ -1438,8 +1439,8 @@ var _native_typed_data;
let _uint32View = Symbol('_uint32View');
class NativeFloat64x2 extends core.Object {
NativeFloat64x2(x, y) {
- this.x = x;
- this.y = y;
+ dart.initField(NativeFloat64x2, this, 'x', x);
+ dart.initField(NativeFloat64x2, this, 'y', y);
if (!dart.is(this.x, core.num))
throw new core.ArgumentError(this.x);
if (!dart.is(this.y, core.num))
@@ -1455,8 +1456,8 @@ var _native_typed_data;
this.NativeFloat64x2(v.x, v.y);
}
[_doubles](x, y) {
- this.x = x;
- this.y = y;
+ dart.initField(NativeFloat64x2, this, 'x', x);
+ dart.initField(NativeFloat64x2, this, 'y', y);
}
toString() {
return `[${this.x}, ${this.y}]`;
« no previous file with comments | « lib/runtime/dart/_js_helper.js ('k') | lib/runtime/dart/async.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698