diff --git a/pkg/dev_compiler/lib/runtime/dart_runtime.js b/pkg/dev_compiler/lib/runtime/dart_runtime.js index 4dd786854bbc..cd8ac458821d 100644 --- a/pkg/dev_compiler/lib/runtime/dart_runtime.js +++ b/pkg/dev_compiler/lib/runtime/dart_runtime.js @@ -967,7 +967,8 @@ var dart, _js_helper, _js_primitives; dart.JsSymbol = Symbol; function import_(value) { - if (!value) throw 'missing required module'; + // TODO(jmesserly): throw once we're loading all of core libs. + if (!value && console) console.warn('missing required module'); return value; } dart.import = import_; diff --git a/pkg/dev_compiler/test/browser/runtime_tests.js b/pkg/dev_compiler/test/browser/runtime_tests.js index 824edd574a3d..9b84c9bc6b58 100644 --- a/pkg/dev_compiler/test/browser/runtime_tests.js +++ b/pkg/dev_compiler/test/browser/runtime_tests.js @@ -391,3 +391,13 @@ suite('instanceOf', () => { assert.equal(intType, core.int); }); }); + +suite('primitives', function() { + 'use strict'; + + test('fixed length list', () => { + let list = new core.List(10); + list[0] = 42; + assert.throws(() => list.add(42)); + }); +}); diff --git a/pkg/dev_compiler/test/generated_sdk/lib/_internal/compiler/js_lib/js_array.dart b/pkg/dev_compiler/test/generated_sdk/lib/_internal/compiler/js_lib/js_array.dart index c9aab5f74eea..fae79523869f 100644 --- a/pkg/dev_compiler/test/generated_sdk/lib/_internal/compiler/js_lib/js_array.dart +++ b/pkg/dev_compiler/test/generated_sdk/lib/_internal/compiler/js_lib/js_array.dart @@ -85,7 +85,7 @@ class JSArray implements List, JSIndexable { } checkGrowable(reason) { - if (this is !JSExtendableArray) { + if (JS('bool', r'#.fixed$length', this)) { throw new UnsupportedError(reason); } } diff --git a/pkg/dev_compiler/tool/input_sdk/private/js_array.dart b/pkg/dev_compiler/tool/input_sdk/private/js_array.dart index c9aab5f74eea..fae79523869f 100644 --- a/pkg/dev_compiler/tool/input_sdk/private/js_array.dart +++ b/pkg/dev_compiler/tool/input_sdk/private/js_array.dart @@ -85,7 +85,7 @@ class JSArray implements List, JSIndexable { } checkGrowable(reason) { - if (this is !JSExtendableArray) { + if (JS('bool', r'#.fixed$length', this)) { throw new UnsupportedError(reason); } }