def slice(this, args): o = this.ToObject() from_index = get_arg(args, 0).ToUInt32() to_index = get_arg(args, 1).ToUInt32() from js.object_space import object_space n = object_space.new_array(length=_w(to_index - from_index)) from js.jsobj import put_property index = 0 for item in xrange(from_index, to_index): put_property(n, unicode(str(index)), o.get(unicode(str(item)))) index += 1 return n
def setup(global_object): from js.builtins import put_native_function, put_property from js.object_space import object_space #String # 15.5.1 from js.jsobj import W_StringConstructor w_String = W_StringConstructor() object_space.assign_proto(w_String, object_space.proto_function) put_property(w_String, u'length', _w(1), writable=False, enumerable=False, configurable=False) put_property(global_object, u'String', w_String) # 15.5.4 w_StringPrototype = W_StringObject(_w(u'')) object_space.assign_proto(w_StringPrototype, object_space.proto_object) # 15.5.3.1 object_space.proto_string = w_StringPrototype put_property(w_String, u'prototype', w_StringPrototype, writable=False, enumerable=False, configurable=False) # 15.5.3.2 put_native_function(w_String, u'fromCharCode', from_char_code, params=[u'char1']) # 15.5.4.1 put_property(w_StringPrototype, u'constructor', w_String) # 15.5.4.2 put_native_function(w_StringPrototype, u'toString', to_string) # 15.5.4.3 put_native_function(w_StringPrototype, u'valueOf', value_of) # 15.5.4.4 put_native_function(w_StringPrototype, u'charAt', char_at, params=[u'pos']) # 15.5.4.5 put_native_function(w_StringPrototype, u'charCodeAt', char_code_at, params=[u'pos']) # 15.5.4.6 put_native_function(w_StringPrototype, u'concat', concat, params=[u'string1']) # 15.5.4.7 put_native_function(w_StringPrototype, u'indexOf', index_of, params=[u'searchstring']) # 15.5.4.8 put_native_function(w_StringPrototype, u'lastIndexOf', last_index_of, params=[u'searchstring']) # 15.5.4.14 put_native_function(w_StringPrototype, u'split', split, params=[u'separator', u'limit']) # 15.5.4.15 put_native_function(w_StringPrototype, u'substring', substring, params=[u'start', u'end']) # 15.5.4.16 put_native_function(w_StringPrototype, u'toLowerCase', to_lower_case) # 15.5.4.18 put_native_function(w_StringPrototype, u'toUpperCase', to_upper_case)
def setup(global_object): from js.builtins import put_property, put_native_function from js.jsobj import W_ArrayConstructor, W__Array from js.object_space import object_space w_Array = W_ArrayConstructor() object_space.assign_proto(w_Array, object_space.proto_function) put_property(global_object, u'Array', w_Array) # 15.4.4 w_ArrayPrototype = W__Array() object_space.assign_proto(w_ArrayPrototype, object_space.proto_object) object_space.proto_array = w_ArrayPrototype # 15.4.3.1 put_property(w_Array, u'prototype', w_ArrayPrototype, writable=False, enumerable=False, configurable=False) # 15.4.4.1 put_property(w_ArrayPrototype, u'constructor', w_Array) # 15.4.4.2 put_native_function(w_ArrayPrototype, u'toString', to_string) # 15.4.4.5 put_native_function(w_ArrayPrototype, u'join', join, params=[u'separator']) # 15.4.4.6 put_native_function(w_ArrayPrototype, u'pop', pop) # 15.4.4.7 put_native_function(w_ArrayPrototype, u'push', push) # 15.4.4.8 put_native_function(w_ArrayPrototype, u'reverse', reverse) # 15.4.4.11 put_native_function(w_ArrayPrototype, u'sort', sort) put_native_function(w_ArrayPrototype, u'forEach', for_each) put_native_function(w_ArrayPrototype, u'indexOf', index_of) put_native_function(w_ArrayPrototype, u'lastIndexOf', last_index_of) put_native_function(w_ArrayPrototype, u'shift', shift) put_native_function(w_ArrayPrototype, u'slice', slice)
def setup(global_object): from js.builtins import put_property, put_native_function from js.object_space import object_space # 15.6.2 from js.jsobj import W_BooleanConstructor w_Boolean = W_BooleanConstructor() object_space.assign_proto(w_Boolean, object_space.proto_function) put_property(global_object, u'Boolean', w_Boolean) # 15.6.3 put_property(w_Boolean, u'length', _w(1), writable=False, enumerable=False, configurable=False) # 15.6.4 w_BooleanPrototype = W_BooleanObject(_w(False)) object_space.assign_proto(w_BooleanPrototype, object_space.proto_object) # 15.6.3.1 object_space.proto_boolean = w_BooleanPrototype # 15.6.3.1 put_property(w_Boolean, u'prototype', w_BooleanPrototype, writable=False, enumerable=False, configurable=False) # 15.6.4.1 put_property(w_BooleanPrototype, u'constructor', w_Boolean) # 15.6.4.2 put_native_function(w_BooleanPrototype, u'toString', to_string) # 15.6.4.3 put_native_function(w_BooleanPrototype, u'valueOf', value_of)
def setup(global_object): from js.builtins import put_property, put_native_function from js.jsobj import W_ArrayConstructor, W__Array from js.object_space import object_space w_Array = W_ArrayConstructor() object_space.assign_proto(w_Array, object_space.proto_function) put_property(global_object, u'Array', w_Array) # 15.4.4 w_ArrayPrototype = W__Array() object_space.assign_proto(w_ArrayPrototype, object_space.proto_object) object_space.proto_array = w_ArrayPrototype # 15.4.3.1 put_property(w_Array, u'prototype', w_ArrayPrototype, writable=False, enumerable=False, configurable=False) # 15.4.4.1 put_property(w_ArrayPrototype, u'constructor', w_Array) # 15.4.4.2 put_native_function(w_ArrayPrototype, u'toString', to_string) # 15.4.4.5 put_native_function(w_ArrayPrototype, u'join', join, params=[u'separator']) # 15.4.4.6 put_native_function(w_ArrayPrototype, u'pop', pop) # 15.4.4.7 put_native_function(w_ArrayPrototype, u'push', push) # 15.4.4.8 put_native_function(w_ArrayPrototype, u'reverse', reverse) # 15.4.4.11 put_native_function(w_ArrayPrototype, u'sort', sort) put_native_function(w_ArrayPrototype, u'forEach', for_each) put_native_function(w_ArrayPrototype, u'indexOf', index_of) put_native_function(w_ArrayPrototype, u'lastIndexOf', last_index_of) put_native_function(w_ArrayPrototype, u'shift', shift) put_native_function(w_ArrayPrototype, u'slice', slice)
def setup(global_object): from rpython.rlib.objectmodel import we_are_translated from js.builtins import put_intimate_function, put_native_function, put_property from js.builtins.number import w_NAN from js.builtins.number import w_POSITIVE_INFINITY from js.object_space import newundefined # 15.1.1.1 put_property(global_object, u'NaN', w_NAN, writable=False, enumerable=False, configurable=False) # 15.1.1.2 put_property(global_object, u'Infinity', w_POSITIVE_INFINITY, writable=False, enumerable=False, configurable=False) # 15.1.1.3 put_property(global_object, u'undefined', newundefined(), writable=False, enumerable=False, configurable=False) # 15.1.2.1 put_intimate_function(global_object, u'eval', js_eval, params=[u'x']) # 15.1.2.2 put_native_function(global_object, u'parseInt', parse_int, params=[u'string', u'radix']) # 15.1.2.3 # TODO put_native_function(global_object, u'parseFloat', parse_float, params=[u'string']) # 15.1.2.4 put_native_function(global_object, u'isNaN', is_nan, params=[u'number']) # 15.1.2.5 put_native_function(global_object, u'isFinite', is_finite, params=[u'number']) put_native_function(global_object, u'alert', alert) put_native_function(global_object, u'print', printjs) put_native_function(global_object, u'escape', escape, params=[u'string']) put_native_function(global_object, u'unescape', unescape, params=[u'string']) put_native_function(global_object, u'version', version) ## debugging if not we_are_translated(): put_native_function(global_object, u'pypy_repr', pypy_repr) put_native_function(global_object, u'inspect', inspect)
def setup(global_object): from js.builtins import put_native_function, put_property from js.jsobj import W_Math from js.object_space import object_space # 15.8 w_Math = W_Math() object_space.assign_proto(w_Math) put_property(global_object, u'Math', w_Math) put_native_function(w_Math, u'abs', js_abs, params=[u'x']) put_native_function(w_Math, u'floor', floor, params=[u'x']) put_native_function(w_Math, u'round', js_round, params=[u'x']) put_native_function(w_Math, u'random', js_random) put_native_function(w_Math, u'min', js_min, params=[u'value1', u'value2']) put_native_function(w_Math, u'max', js_max, params=[u'value1', u'value2']) put_native_function(w_Math, u'pow', js_pow, params=[u'x', u'y']) put_native_function(w_Math, u'sqrt', js_sqrt, params=[u'x']) put_native_function(w_Math, u'log', js_log, params=[u'x']) put_native_function(w_Math, u'sin', js_sin, params=[u'x']) put_native_function(w_Math, u'tan', js_tan, params=[u'x']) put_native_function(w_Math, u'acos', js_acos, params=[u'x']) put_native_function(w_Math, u'asin', js_asin, params=[u'x']) put_native_function(w_Math, u'atan', js_atan, params=[u'x']) put_native_function(w_Math, u'atan2', js_atan2, params=[u'y', u'x']) put_native_function(w_Math, u'ceil', js_ceil, params=[u'x']) put_native_function(w_Math, u'cos', js_cos, params=[u'x']) put_native_function(w_Math, u'exp', js_exp, params=[u'x']) # 15.8.1 # 15.8.1.1 put_property(w_Math, u'E', _w(E), writable=False, enumerable=False, configurable=False) # 15.8.1.2 put_property(w_Math, u'LN10', _w(LN10), writable=False, enumerable=False, configurable=False) # 15.8.1.3 put_property(w_Math, u'LN2', _w(LN2), writable=False, enumerable=False, configurable=False) # 15.8.1.4 put_property(w_Math, u'LOG2E', _w(LOG2E), writable=False, enumerable=False, configurable=False) # 15.8.1.5 put_property(w_Math, u'LOG10E', _w(LOG10E), writable=False, enumerable=False, configurable=False) # 15.8.1.6 put_property(w_Math, u'PI', _w(PI), writable=False, enumerable=False, configurable=False) # 15.8.1.7 put_property(w_Math, u'SQRT1_2', _w(SQRT1_2), writable=False, enumerable=False, configurable=False) # 15.8.1.8 put_property(w_Math, u'SQRT2', _w(SQRT2), writable=False, enumerable=False, configurable=False)
def setup(global_object): from js.builtins import put_property, put_native_function from js.jsobj import W_DateObject, W_DateConstructor from js.object_space import object_space ##Date # 15.9.5 w_DatePrototype = W_DateObject(_w(NAN)) # TODO #object_space.assign_proto(w_DatePrototype, object_space.proto_object) object_space.proto_date = w_DatePrototype put_native_function(w_DatePrototype, u'toString', to_string) put_native_function(w_DatePrototype, u'valueOf', value_of) put_native_function(w_DatePrototype, u'getTime', get_time) put_native_function(w_DatePrototype, u'getFullYear', get_full_year) put_native_function(w_DatePrototype, u'getUTCFullYear', get_utc_full_year) put_native_function(w_DatePrototype, u'getMonth', get_month) put_native_function(w_DatePrototype, u'getUTCMonth', get_utc_month) put_native_function(w_DatePrototype, u'getDate', get_date) put_native_function(w_DatePrototype, u'getUTCDate', get_utc_date) put_native_function(w_DatePrototype, u'getDay', get_day) put_native_function(w_DatePrototype, u'getUTCDay', get_utc_day) put_native_function(w_DatePrototype, u'getHours', get_hours) put_native_function(w_DatePrototype, u'getUTCHours', get_utc_hours) put_native_function(w_DatePrototype, u'getMinutes', get_minutes) put_native_function(w_DatePrototype, u'getUTCMinutes', get_utc_minutes) put_native_function(w_DatePrototype, u'getSeconds', get_seconds) put_native_function(w_DatePrototype, u'getUTCSeconds', get_utc_seconds) put_native_function(w_DatePrototype, u'getMilliseconds', get_milliseconds) put_native_function(w_DatePrototype, u'getUTCMilliseconds', get_utc_milliseconds) put_native_function(w_DatePrototype, u'getTimezoneOffset', get_timezone_offset) put_native_function(w_DatePrototype, u'setTime', set_time) put_native_function(w_DatePrototype, u'setMilliseconds', set_milliseconds) put_native_function(w_DatePrototype, u'setUTCMilliseconds', set_utc_milliseconds) put_native_function(w_DatePrototype, u'setSeconds', set_seconds) put_native_function(w_DatePrototype, u'setUTCSeconds', set_utc_seconds) put_native_function(w_DatePrototype, u'setMinutes', set_minutes) put_native_function(w_DatePrototype, u'setUTCMinutes', set_utc_minutes) put_native_function(w_DatePrototype, u'setHours', set_hours) put_native_function(w_DatePrototype, u'setUTCHours', set_utc_hours) put_native_function(w_DatePrototype, u'setDate', set_date) put_native_function(w_DatePrototype, u'setUTCDate', set_utc_date) put_native_function(w_DatePrototype, u'setMonth', set_month) put_native_function(w_DatePrototype, u'setUTCMonth', set_utc_month) put_native_function(w_DatePrototype, u'setFullYear', set_full_year) put_native_function(w_DatePrototype, u'setUTCFullYear', set_utc_full_year) put_native_function(w_DatePrototype, u'getYear', get_year) put_native_function(w_DatePrototype, u'setYear', set_year) put_native_function(w_DatePrototype, u'toUTCString', to_utc_string) put_native_function(w_DatePrototype, u'toGMTString', to_gmt_string) # 15.9.3 w_Date = W_DateConstructor() object_space.assign_proto(w_Date, object_space.proto_function) put_property(global_object, u'Date', w_Date) put_property(w_Date, u'prototype', w_DatePrototype, writable=False, enumerable=False, configurable=False) put_native_function(w_Date, u'parse', parse) put_native_function(w_Date, u'now', now) put_native_function(w_Date, u'UTC', parse) # 15.9.5.1 put_property(w_DatePrototype, u'constructor', w_Date)
def setup(global_object): from js.builtins import put_native_function, put_property from js.jsobj import W_Math from js.object_space import object_space # 15.8 w_Math = W_Math() object_space.assign_proto(w_Math) put_property(global_object, u'Math', w_Math) put_native_function(w_Math, u'abs', js_abs, params=[u'x']) put_native_function(w_Math, u'floor', floor, params=[u'x']) put_native_function(w_Math, u'round', js_round, params=[u'x']) put_native_function(w_Math, u'random', js_random) put_native_function(w_Math, u'min', js_min, params=[u'value1', u'value2']) put_native_function(w_Math, u'max', js_max, params=[u'value1', u'value2']) put_native_function(w_Math, u'pow', js_pow, params=[u'x', u'y']) put_native_function(w_Math, u'sqrt', js_sqrt, params=[u'x']) put_native_function(w_Math, u'log', js_log, params=[u'x']) put_native_function(w_Math, u'sin', js_sin, params=[u'x']) put_native_function(w_Math, u'tan', js_tan, params=[u'x']) put_native_function(w_Math, u'acos', js_acos, params=[u'x']) put_native_function(w_Math, u'asin', js_asin, params=[u'x']) put_native_function(w_Math, u'atan', js_atan, params=[u'x']) put_native_function(w_Math, u'atan2', js_atan2, params=[u'y', u'x']) put_native_function(w_Math, u'ceil', js_ceil, params=[u'x']) put_native_function(w_Math, u'cos', js_cos, params=[u'x']) put_native_function(w_Math, u'exp', js_exp, params=[u'x']) # 15.8.1 # 15.8.1.1 put_property(w_Math, u'E', _w(E), writable=False, enumerable=False, configurable=False) # 15.8.1.2 put_property(w_Math, u'LN10', _w(LN10), writable=False, enumerable=False, configurable=False) # 15.8.1.3 put_property(w_Math, u'LN2', _w(LN2), writable=False, enumerable=False, configurable=False) # 15.8.1.4 put_property(w_Math, u'LOG2E', _w(LOG2E), writable=False, enumerable=False, configurable=False) # 15.8.1.5 put_property(w_Math, u'LOG10E', _w(LOG10E), writable=False, enumerable=False, configurable=False) # 15.8.1.6 put_property(w_Math, u'PI', _w(PI), writable=False, enumerable=False, configurable=False) # 15.8.1.7 put_property(w_Math, u'SQRT1_2', _w(SQRT1_2), writable=False, enumerable=False, configurable=False) # 15.8.1.8 put_property(w_Math, u'SQRT2', _w(SQRT2), writable=False, enumerable=False, configurable=False)
def setup(global_object): from js.builtins import put_property, put_native_function from js.jsobj import W_DateObject, W_DateConstructor from js.object_space import object_space ##Date # 15.9.5 w_DatePrototype = W_DateObject(_w(NAN)) # TODO #object_space.assign_proto(w_DatePrototype, object_space.proto_object) object_space.proto_date = w_DatePrototype put_native_function(w_DatePrototype, u'toString', to_string) put_native_function(w_DatePrototype, u'valueOf', value_of) put_native_function(w_DatePrototype, u'getTime', get_time) put_native_function(w_DatePrototype, u'getFullYear', get_full_year) put_native_function(w_DatePrototype, u'getUTCFullYear', get_utc_full_year) put_native_function(w_DatePrototype, u'getMonth', get_month) put_native_function(w_DatePrototype, u'getUTCMonth', get_utc_month) put_native_function(w_DatePrototype, u'getDate', get_date) put_native_function(w_DatePrototype, u'getUTCDate', get_utc_date) put_native_function(w_DatePrototype, u'getDay', get_day) put_native_function(w_DatePrototype, u'getUTCDay', get_utc_day) put_native_function(w_DatePrototype, u'getHours', get_hours) put_native_function(w_DatePrototype, u'getUTCHours', get_utc_hours) put_native_function(w_DatePrototype, u'getMinutes', get_minutes) put_native_function(w_DatePrototype, u'getUTCMinutes', get_utc_minutes) put_native_function(w_DatePrototype, u'getSeconds', get_seconds) put_native_function(w_DatePrototype, u'getUTCSeconds', get_utc_seconds) put_native_function(w_DatePrototype, u'getMilliseconds', get_milliseconds) put_native_function(w_DatePrototype, u'getUTCMilliseconds', get_utc_milliseconds) put_native_function(w_DatePrototype, u'getTimezoneOffset', get_timezone_offset) put_native_function(w_DatePrototype, u'setTime', set_time) put_native_function(w_DatePrototype, u'setMilliseconds', set_milliseconds) put_native_function(w_DatePrototype, u'setUTCMilliseconds', set_utc_milliseconds) put_native_function(w_DatePrototype, u'setSeconds', set_seconds) put_native_function(w_DatePrototype, u'setUTCSeconds', set_utc_seconds) put_native_function(w_DatePrototype, u'setMinutes', set_minutes) put_native_function(w_DatePrototype, u'setUTCMinutes', set_utc_minutes) put_native_function(w_DatePrototype, u'setHours', set_hours) put_native_function(w_DatePrototype, u'setUTCHours', set_utc_hours) put_native_function(w_DatePrototype, u'setDate', set_date) put_native_function(w_DatePrototype, u'setUTCDate', set_utc_date) put_native_function(w_DatePrototype, u'setMonth', set_month) put_native_function(w_DatePrototype, u'setUTCMonth', set_utc_month) put_native_function(w_DatePrototype, u'setFullYear', set_full_year) put_native_function(w_DatePrototype, u'setUTCFullYear', set_utc_full_year) put_native_function(w_DatePrototype, u'getYear', get_year) put_native_function(w_DatePrototype, u'setYear', set_year) put_native_function(w_DatePrototype, u'toUTCString', to_utc_string) put_native_function(w_DatePrototype, u'toGMTString', to_gmt_string) # 15.9.3 w_Date = W_DateConstructor() object_space.assign_proto(w_Date, object_space.proto_function) put_property(global_object, u'Date', w_Date) put_property(w_Date, u'prototype', w_DatePrototype, writable=False, enumerable=False, configurable=False) put_native_function(w_Date, u'parse', parse) put_native_function(w_Date, u'now', now) put_native_function(w_Date, u'UTC', parse) # 15.9.5.1 put_property(w_DatePrototype, u'constructor', w_Date)
def setup(global_object): from js.builtins import put_native_function, put_property from js.object_space import object_space #String # 15.5.1 from js.jsobj import W_StringConstructor w_String = W_StringConstructor() object_space.assign_proto(w_String, object_space.proto_function) put_property(w_String, u'length', _w(1), writable=False, enumerable=False, configurable=False) put_property(global_object, u'String', w_String) # 15.5.4 w_StringPrototype = W_StringObject(_w(u'')) object_space.assign_proto(w_StringPrototype, object_space.proto_object) # 15.5.3.1 object_space.proto_string = w_StringPrototype put_property(w_String, u'prototype', w_StringPrototype, writable=False, enumerable=False, configurable=False) # 15.5.3.2 put_native_function(w_String, u'fromCharCode', from_char_code, params=[u'char1']) # 15.5.4.1 put_property(w_StringPrototype, u'constructor', w_String) # 15.5.4.2 put_native_function(w_StringPrototype, u'toString', to_string) # 15.5.4.3 put_native_function(w_StringPrototype, u'valueOf', value_of) # 15.5.4.4 put_native_function(w_StringPrototype, u'charAt', char_at, params=[u'pos']) # 15.5.4.5 put_native_function(w_StringPrototype, u'charCodeAt', char_code_at, params=[u'pos']) # 15.5.4.6 put_native_function(w_StringPrototype, u'concat', concat, params=[u'string1']) # 15.5.4.7 put_native_function(w_StringPrototype, u'indexOf', index_of, params=[u'searchstring']) # 15.5.4.8 put_native_function(w_StringPrototype, u'lastIndexOf', last_index_of, params=[u'searchstring']) # 15.5.4.14 put_native_function(w_StringPrototype, u'split', split, params=[u'separator', u'limit']) # 15.5.4.15 put_native_function(w_StringPrototype, u'substring', substring, params=[u'start', u'end']) # 15.5.4.16 put_native_function(w_StringPrototype, u'toLowerCase', to_lower_case) # 15.5.4.18 put_native_function(w_StringPrototype, u'toUpperCase', to_upper_case)
def setup(global_object): from rpython.rlib.objectmodel import we_are_translated from js.builtins import put_intimate_function, put_native_function, put_property from js.builtins.number import w_NAN from js.builtins.number import w_POSITIVE_INFINITY from js.object_space import newundefined # 15.1.1.1 put_property(global_object, u'NaN', w_NAN, writable=False, enumerable=False, configurable=False) # 15.1.1.2 put_property(global_object, u'Infinity', w_POSITIVE_INFINITY, writable=False, enumerable=False, configurable=False) # 15.1.1.3 put_property(global_object, u'undefined', newundefined(), writable=False, enumerable=False, configurable=False) # 15.1.2.1 put_intimate_function(global_object, u'eval', js_eval, params=[u'x']) # 15.1.2.2 put_native_function(global_object, u'parseInt', parse_int, params=[u'string', u'radix']) # 15.1.2.3 # TODO put_native_function(global_object, u'parseFloat', parse_float, params=[u'string']) # 15.1.2.4 put_native_function(global_object, u'isNaN', is_nan, params=[u'number']) # 15.1.2.5 put_native_function(global_object, u'isFinite', is_finite, params=[u'number']) put_native_function(global_object, u'alert', alert) put_native_function(global_object, u'print', printjs) put_native_function(global_object, u'escape', escape, params=[u'string']) put_native_function(global_object, u'unescape', unescape, params=[u'string']) put_native_function(global_object, u'version', version) ## debugging if not we_are_translated(): put_native_function(global_object, u'pypy_repr', pypy_repr) put_native_function(global_object, u'inspect', inspect)
def setup(global_object): from js.builtins import put_property, put_native_function from js.object_space import object_space # 15.7.2 from js.jsobj import W_NumberConstructor w_Number = W_NumberConstructor() object_space.assign_proto(w_Number, object_space.proto_function) put_property(global_object, u'Number', w_Number) # 15.7.3 put_property(w_Number, u'length', _w(1), writable=False, enumerable=False, configurable=False) # 15.7.4 w_NumberPrototype = W_NumericObject(_w(0)) object_space.assign_proto(w_NumberPrototype, object_space.proto_object) object_space.proto_number = w_NumberPrototype # 15.7.4.1 put_property(w_NumberPrototype, u'constructor', w_Number) # 15.7.4.2 put_native_function(w_NumberPrototype, u'toString', to_string) # 15.7.4.4 put_native_function(w_NumberPrototype, u'valueOf', value_of) # 15.7.3.1 put_property(w_Number, u'prototype', w_NumberPrototype, writable=False, enumerable=False, configurable=False) # 15.7.3.2 put_property(w_Number, u'MAX_VALUE', w_MAX_VALUE, writable=False, configurable=False, enumerable=False) # 15.7.3.3 put_property(w_Number, u'MIN_VALUE', w_MIN_VALUE, writable=False, configurable=False, enumerable=False) # 15.7.3.4 put_property(w_Number, u'NaN', w_NAN, writable=False, configurable=False, enumerable=False) # 15.7.3.5 put_property(w_Number, u'POSITIVE_INFINITY', w_POSITIVE_INFINITY, writable=False, configurable=False, enumerable=False) # 15.7.3.6 put_property(w_Number, u'NEGATIVE_INFINITY', w_NEGATIVE_INFINITY, writable=False, configurable=False, enumerable=False)
def setup(global_object): from js.builtins import put_property, put_native_function from js.object_space import object_space # 15.7.2 from js.jsobj import W_NumberConstructor w_Number = W_NumberConstructor() object_space.assign_proto(w_Number, object_space.proto_function) put_property(global_object, u'Number', w_Number) # 15.7.3 put_property(w_Number, u'length', _w(1), writable=False, enumerable=False, configurable=False) # 15.7.4 w_NumberPrototype = W_NumericObject(_w(0)) object_space.assign_proto(w_NumberPrototype, object_space.proto_object) object_space.proto_number = w_NumberPrototype # 15.7.4.1 put_property(w_NumberPrototype, u'constructor', w_Number) # 15.7.4.2 put_native_function(w_NumberPrototype, u'toString', to_string) # 15.7.4.4 put_native_function(w_NumberPrototype, u'valueOf', value_of) # 15.7.3.1 put_property(w_Number, u'prototype', w_NumberPrototype, writable=False, enumerable=False, configurable=False) # 15.7.3.2 put_property(w_Number, u'MAX_VALUE', w_MAX_VALUE, writable=False, configurable=False, enumerable=False) # 15.7.3.3 put_property(w_Number, u'MIN_VALUE', w_MIN_VALUE, writable=False, configurable=False, enumerable=False) # 15.7.3.4 put_property(w_Number, u'NaN', w_NAN, writable=False, configurable=False, enumerable=False) # 15.7.3.5 put_property(w_Number, u'POSITIVE_INFINITY', w_POSITIVE_INFINITY, writable=False, configurable=False, enumerable=False) # 15.7.3.6 put_property(w_Number, u'NEGATIVE_INFINITY', w_NEGATIVE_INFINITY, writable=False, configurable=False, enumerable=False)