Changeset 184871 in webkit for trunk/Source/JavaScriptCore


Ignore:
Timestamp:
May 26, 2015, 2:17:22 PM (10 years ago)
Author:
Yusuke Suzuki
Message:

Reflect nits for r184863
https://bugs.webkit.org/show_bug.cgi?id=145107

Reviewed by Darin Adler.

  1. Added the copyright line.
  2. Added an optional argument (/*, end */). To do so, fixed generate-js-builtins.
  3. Dropped the unnecessary variable thisValue.
  4. Fix the type error messages. This is also found in StringIterator.prototype.js.
  5. Added tests for 0 arguments.
  • builtins/Array.prototype.js:

(copyWithin):

  • builtins/StringIterator.prototype.js:

(next):

  • generate-js-builtins:
  • tests/stress/array-copywithin.js:
  • tests/stress/string-iterators.js:
Location:
trunk/Source/JavaScriptCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r184868 r184871  
     12015-05-26  Yusuke Suzuki  <[email protected]>
     2
     3        Reflect nits for r184863
     4        https://bugs.webkit.org/show_bug.cgi?id=145107
     5
     6        Reviewed by Darin Adler.
     7
     8        1. Added the copyright line.
     9        2. Added an optional argument (/*, end */). To do so, fixed generate-js-builtins.
     10        3. Dropped the unnecessary variable `thisValue`.
     11        4. Fix the type error messages. This is also found in StringIterator.prototype.js.
     12        5. Added tests for 0 arguments.
     13
     14        * builtins/Array.prototype.js:
     15        (copyWithin):
     16        * builtins/StringIterator.prototype.js:
     17        (next):
     18        * generate-js-builtins:
     19        * tests/stress/array-copywithin.js:
     20        * tests/stress/string-iterators.js:
     21
    1222015-05-26  Yusuke Suzuki  <[email protected]>
    223
  • trunk/Source/JavaScriptCore/builtins/Array.prototype.js

    r184863 r184871  
    11/*
    22 * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
     3 * Copyright (C) 2015 Yusuke Suzuki <[email protected]>.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    457458}
    458459
    459 function copyWithin(target, start)
     460function copyWithin(target, start /*, end */)
    460461{
    461462    "use strict";
     
    471472    }
    472473
    473     var thisValue = this;
    474     if (thisValue === null || thisValue === undefined)
    475         throw new @TypeError("Array.copyWithin requires that |this| be not null or undefined");
    476     var thisObject = @Object(thisValue);
     474    if (this === null || this === undefined)
     475        throw new @TypeError("Array.copyWithin requires that |this| not be null or undefined");
     476    var thisObject = @Object(this);
    477477
    478478    var length = @ToLength(thisObject.length);
  • trunk/Source/JavaScriptCore/builtins/StringIterator.prototype.js

    r182118 r184871  
    2828
    2929    if (this == null)
    30         throw new @TypeError("%StringIteratorPrototype%.next requires that |this| be not null or undefined");
     30        throw new @TypeError("%StringIteratorPrototype%.next requires that |this| not be null or undefined");
    3131
    3232    var position = this.@stringIteratorNextIndex;
  • trunk/Source/JavaScriptCore/generate-js-builtins

    r183738 r184871  
    6767functionHeadRegExp = re.compile(r"function\s+\w+\s*\(.*?\)", re.MULTILINE | re.S)
    6868functionNameRegExp = re.compile(r"function\s+(\w+)\s*\(", re.MULTILINE | re.S)
    69 functionParameterFinder = re.compile(r"^function\s+(?:\w+)\s*\(((?:\s*\w+)?\s*(?:\s*,\s*\w+)*)?\)", re.MULTILINE | re.S)
     69functionParameterFinder = re.compile(r"^function\s+(?:\w+)\s*\(((?:\s*\w+)?\s*(?:\s*,\s*\w+)*)?\s*\)", re.MULTILINE | re.S)
    7070
    7171multilineCommentRegExp = re.compile(r"\/\*.*?\*\/", re.MULTILINE | re.S)
  • trunk/Source/JavaScriptCore/tests/stress/array-copywithin.js

    r184863 r184871  
    3535shouldBe(Array.prototype.hasOwnProperty('copyWithin'), true);
    3636shouldBe(JSON.stringify(Object.getOwnPropertyDescriptor(Array.prototype, 'copyWithin')), '{"writable":true,"enumerable":false,"configurable":true}');
     37
     38// 0 arguments. (it is equivalent to copyWithin(0))
     39shouldBeArray([1, 2, 3, 4, 5].copyWithin(), [1, 2, 3, 4, 5]);
     40shouldBeArray([].copyWithin(), []);
    3741
    3842// 1 arguments.
     
    235239shouldThrow(function () {
    236240    Array.prototype.copyWithin.call(undefined);
    237 }, 'TypeError: Array.copyWithin requires that |this| be not null or undefined');
     241}, 'TypeError: Array.copyWithin requires that |this| not be null or undefined');
    238242
    239243shouldThrow(function () {
    240244    Array.prototype.copyWithin.call(null);
    241 }, 'TypeError: Array.copyWithin requires that |this| be not null or undefined');
     245}, 'TypeError: Array.copyWithin requires that |this| not be null or undefined');
    242246
    243247
  • trunk/Source/JavaScriptCore/tests/stress/string-iterators.js

    r182118 r184871  
    183183    var message = 'TypeError: %StringIteratorPrototype%.next requires that |this| be a String Iterator instance';
    184184    if (primitive == null)
    185         message = 'TypeError: %StringIteratorPrototype%.next requires that |this| be not null or undefined'
     185        message = 'TypeError: %StringIteratorPrototype%.next requires that |this| not be null or undefined'
    186186    if (String(didThrow) !== message)
    187187        throw "Error: bad error thrown: " + didThrow;
Note: See TracChangeset for help on using the changeset viewer.