Skip to content

Commit ef8edb1

Browse files
author
John Messerly
committed
1 parent da20815 commit ef8edb1

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

pkg/dev_compiler/lib/runtime/dart_runtime.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,8 @@ var dart, _js_helper, _js_primitives;
967967
dart.JsSymbol = Symbol;
968968

969969
function import_(value) {
970-
if (!value) throw 'missing required module';
970+
// TODO(jmesserly): throw once we're loading all of core libs.
971+
if (!value && console) console.warn('missing required module');
971972
return value;
972973
}
973974
dart.import = import_;

pkg/dev_compiler/test/browser/runtime_tests.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,3 +391,13 @@ suite('instanceOf', () => {
391391
assert.equal(intType, core.int);
392392
});
393393
});
394+
395+
suite('primitives', function() {
396+
'use strict';
397+
398+
test('fixed length list', () => {
399+
let list = new core.List(10);
400+
list[0] = 42;
401+
assert.throws(() => list.add(42));
402+
});
403+
});

pkg/dev_compiler/test/generated_sdk/lib/_internal/compiler/js_lib/js_array.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class JSArray<E> implements List<E>, JSIndexable {
8585
}
8686

8787
checkGrowable(reason) {
88-
if (this is !JSExtendableArray) {
88+
if (JS('bool', r'#.fixed$length', this)) {
8989
throw new UnsupportedError(reason);
9090
}
9191
}

pkg/dev_compiler/tool/input_sdk/private/js_array.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class JSArray<E> implements List<E>, JSIndexable {
8585
}
8686

8787
checkGrowable(reason) {
88-
if (this is !JSExtendableArray) {
88+
if (JS('bool', r'#.fixed$length', this)) {
8989
throw new UnsupportedError(reason);
9090
}
9191
}

0 commit comments

Comments
 (0)