From 158c03b07f5161c672fe42dff4e526ed32a99a06 Mon Sep 17 00:00:00 2001 From: Anton Bannykh Date: Tue, 6 Jun 2017 20:10:07 +0300 Subject: [PATCH] JS: enable TypedArrays by default --- .../common/arguments/K2JSCompilerArguments.java | 0 js/js.libraries/src/js/polyfills.js | 16 ++++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.java diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.java b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.java new file mode 100644 index 00000000000..e69de29bb2d diff --git a/js/js.libraries/src/js/polyfills.js b/js/js.libraries/src/js/polyfills.js index f393d433b60..1b4a2490490 100644 --- a/js/js.libraries/src/js/polyfills.js +++ b/js/js.libraries/src/js/polyfills.js @@ -32,13 +32,13 @@ if (typeof String.prototype.endsWith === "undefined") { }; } // For HtmlUnit and PhantomJs -(function() { - if (typeof ArrayBuffer.isView === "undefined") { - ArrayBuffer.isView = function(a) { - return a != null && a.__proto__ != null && a.__proto__.__proto__ === Int8Array.prototype.__proto__; - }; - } +if (typeof ArrayBuffer.isView === "undefined") { + ArrayBuffer.isView = function(a) { + return a != null && a.__proto__ != null && a.__proto__.__proto__ === Int8Array.prototype.__proto__; + }; +} +(function() { function normalizeOffset(offset, length) { if (offset < 0) return Math.max(0, offset + length); return Math.min(offset, length); @@ -81,7 +81,7 @@ if (typeof String.prototype.endsWith === "undefined") { if (typeof TypedArray.prototype.map === "undefined") { Object.defineProperty(TypedArray.prototype, 'map', { value: function(callback, self) { - return typedArraySlice.call([].map.call(this, callback, self)); + return [].slice.call(this).map(callback, self); } }); } @@ -98,4 +98,4 @@ if (typeof String.prototype.endsWith === "undefined") { }); } } -})(); \ No newline at end of file +})();