Revision f230a1cf deps/v8/src/i18n.js

View differences:

deps/v8/src/i18n.js
258 258
          // DateTimeFormat.format needs to be 0 arg method, but can stil
259 259
          // receive optional dateValue param. If one was provided, pass it
260 260
          // along.
261
          if (arguments.length > 0) {
262
            return implementation(that, arguments[0]);
261
          if (%_ArgumentsLength() > 0) {
262
            return implementation(that, %_Arguments(0));
263 263
          } else {
264 264
            return implementation(that);
265 265
          }
......
290 290
 * Parameter locales is treated as a priority list.
291 291
 */
292 292
function supportedLocalesOf(service, locales, options) {
293
  if (service.match(GetServiceRE()) === null) {
293
  if (IS_NULL(service.match(GetServiceRE()))) {
294 294
    throw new $Error('Internal error, wrong service type: ' + service);
295 295
  }
296 296

  
......
447 447
 * lookup algorithm.
448 448
 */
449 449
function lookupMatcher(service, requestedLocales) {
450
  if (service.match(GetServiceRE()) === null) {
450
  if (IS_NULL(service.match(GetServiceRE()))) {
451 451
    throw new $Error('Internal error, wrong service type: ' + service);
452 452
  }
453 453

  
......
463 463
      if (AVAILABLE_LOCALES[service][locale] !== undefined) {
464 464
        // Return the resolved locale and extension.
465 465
        var extensionMatch = requestedLocales[i].match(GetUnicodeExtensionRE());
466
        var extension = (extensionMatch === null) ? '' : extensionMatch[0];
466
        var extension = IS_NULL(extensionMatch) ? '' : extensionMatch[0];
467 467
        return {'locale': locale, 'extension': extension, 'position': i};
468 468
      }
469 469
      // Truncate locale if possible.
......
535 535
 * Converts parameter to an Object if possible.
536 536
 */
537 537
function toObject(value) {
538
  if (value === undefined || value === null) {
538
  if (IS_NULL_OR_UNDEFINED(value)) {
539 539
    throw new $TypeError('Value cannot be converted to an Object.');
540 540
  }
541 541

  
......
733 733
function canonicalizeLanguageTag(localeID) {
734 734
  // null is typeof 'object' so we have to do extra check.
735 735
  if (typeof localeID !== 'string' && typeof localeID !== 'object' ||
736
      localeID === null) {
736
      IS_NULL(localeID)) {
737 737
    throw new $TypeError('Language ID should be string or object.');
738 738
  }
739 739

  
......
978 978
 * @constructor
979 979
 */
980 980
%SetProperty(Intl, 'Collator', function() {
981
    var locales = arguments[0];
982
    var options = arguments[1];
981
    var locales = %_Arguments(0);
982
    var options = %_Arguments(1);
983 983

  
984 984
    if (!this || this === Intl) {
985 985
      // Constructor is called as a function.
......
1038 1038
      throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR);
1039 1039
    }
1040 1040

  
1041
    return supportedLocalesOf('collator', locales, arguments[1]);
1041
    return supportedLocalesOf('collator', locales, %_Arguments(1));
1042 1042
  },
1043 1043
  DONT_ENUM
1044 1044
);
......
1207 1207
 * @constructor
1208 1208
 */
1209 1209
%SetProperty(Intl, 'NumberFormat', function() {
1210
    var locales = arguments[0];
1211
    var options = arguments[1];
1210
    var locales = %_Arguments(0);
1211
    var options = %_Arguments(1);
1212 1212

  
1213 1213
    if (!this || this === Intl) {
1214 1214
      // Constructor is called as a function.
......
1286 1286
      throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR);
1287 1287
    }
1288 1288

  
1289
    return supportedLocalesOf('numberformat', locales, arguments[1]);
1289
    return supportedLocalesOf('numberformat', locales, %_Arguments(1));
1290 1290
  },
1291 1291
  DONT_ENUM
1292 1292
);
......
1367 1367
  ldmlString += appendToLDMLString(option, {'2-digit': 'ss', 'numeric': 's'});
1368 1368

  
1369 1369
  option = getOption('timeZoneName', 'string', ['short', 'long']);
1370
  ldmlString += appendToLDMLString(option, {short: 'v', long: 'vv'});
1370
  ldmlString += appendToLDMLString(option, {short: 'z', long: 'zzzz'});
1371 1371

  
1372 1372
  return ldmlString;
1373 1373
}
......
1440 1440
  options = appendToDateTimeObject(
1441 1441
      options, 'second', match, {s: 'numeric', ss: '2-digit'});
1442 1442

  
1443
  match = ldmlString.match(/v{1,2}/g);
1443
  match = ldmlString.match(/z|zzzz/g);
1444 1444
  options = appendToDateTimeObject(
1445
      options, 'timeZoneName', match, {v: 'short', vv: 'long'});
1445
      options, 'timeZoneName', match, {z: 'short', zzzz: 'long'});
1446 1446

  
1447 1447
  return options;
1448 1448
}
1449 1449

  
1450 1450

  
1451 1451
function appendToDateTimeObject(options, option, match, pairs) {
1452
  if (match === null) {
1452
  if (IS_NULL(match)) {
1453 1453
    if (!options.hasOwnProperty(option)) {
1454 1454
      defineWEProperty(options, option, undefined);
1455 1455
    }
......
1606 1606
 * @constructor
1607 1607
 */
1608 1608
%SetProperty(Intl, 'DateTimeFormat', function() {
1609
    var locales = arguments[0];
1610
    var options = arguments[1];
1609
    var locales = %_Arguments(0);
1610
    var options = %_Arguments(1);
1611 1611

  
1612 1612
    if (!this || this === Intl) {
1613 1613
      // Constructor is called as a function.
......
1685 1685
      throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR);
1686 1686
    }
1687 1687

  
1688
    return supportedLocalesOf('dateformat', locales, arguments[1]);
1688
    return supportedLocalesOf('dateformat', locales, %_Arguments(1));
1689 1689
  },
1690 1690
  DONT_ENUM
1691 1691
);
......
1751 1751
  // We expect only _ and / beside ASCII letters.
1752 1752
  // All inputs should conform to Area/Location from now on.
1753 1753
  var match = GetTimezoneNameCheckRE().exec(tzID);
1754
  if (match === null) {
1754
  if (IS_NULL(match)) {
1755 1755
    throw new $RangeError('Expected Area/Location for time zone, got ' + tzID);
1756 1756
  }
1757 1757

  
......
1812 1812
 * @constructor
1813 1813
 */
1814 1814
%SetProperty(Intl, 'v8BreakIterator', function() {
1815
    var locales = arguments[0];
1816
    var options = arguments[1];
1815
    var locales = %_Arguments(0);
1816
    var options = %_Arguments(1);
1817 1817

  
1818 1818
    if (!this || this === Intl) {
1819 1819
      // Constructor is called as a function.
......
1868 1868
      throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR);
1869 1869
    }
1870 1870

  
1871
    return supportedLocalesOf('breakiterator', locales, arguments[1]);
1871
    return supportedLocalesOf('breakiterator', locales, %_Arguments(1));
1872 1872
  },
1873 1873
  DONT_ENUM
1874 1874
);
......
1971 1971
      throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR);
1972 1972
    }
1973 1973

  
1974
    if (this === undefined || this === null) {
1974
    if (IS_NULL_OR_UNDEFINED(this)) {
1975 1975
      throw new $TypeError('Method invoked on undefined or null value.');
1976 1976
    }
1977 1977

  
1978
    var locales = arguments[1];
1979
    var options = arguments[2];
1978
    var locales = %_Arguments(1);
1979
    var options = %_Arguments(2);
1980 1980
    var collator = cachedOrNewService('collator', locales, options);
1981 1981
    return compare(collator, this, that);
1982 1982
  },
......
2003 2003
      throw new $TypeError('Method invoked on an object that is not Number.');
2004 2004
    }
2005 2005

  
2006
    var locales = arguments[0];
2007
    var options = arguments[1];
2006
    var locales = %_Arguments(0);
2007
    var options = %_Arguments(1);
2008 2008
    var numberFormat = cachedOrNewService('numberformat', locales, options);
2009 2009
    return formatNumber(numberFormat, this);
2010 2010
  },
......
2049 2049
      throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR);
2050 2050
    }
2051 2051

  
2052
    var locales = arguments[0];
2053
    var options = arguments[1];
2052
    var locales = %_Arguments(0);
2053
    var options = %_Arguments(1);
2054 2054
    return toLocaleDateTime(
2055 2055
        this, locales, options, 'any', 'all', 'dateformatall');
2056 2056
  },
......
2074 2074
      throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR);
2075 2075
    }
2076 2076

  
2077
    var locales = arguments[0];
2078
    var options = arguments[1];
2077
    var locales = %_Arguments(0);
2078
    var options = %_Arguments(1);
2079 2079
    return toLocaleDateTime(
2080 2080
        this, locales, options, 'date', 'date', 'dateformatdate');
2081 2081
  },
......
2099 2099
      throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR);
2100 2100
    }
2101 2101

  
2102
    var locales = arguments[0];
2103
    var options = arguments[1];
2102
    var locales = %_Arguments(0);
2103
    var options = %_Arguments(1);
2104 2104
    return toLocaleDateTime(
2105 2105
        this, locales, options, 'time', 'time', 'dateformattime');
2106 2106
  },

Also available in: Unified diff