mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
855 B
38 lines
855 B
/*
|
|
* Number objects (E5 Section 15.7).
|
|
*/
|
|
|
|
/*---
|
|
{
|
|
"skip": true
|
|
}
|
|
---*/
|
|
|
|
/* FIXME */
|
|
|
|
/*===
|
|
undefined
|
|
true
|
|
true
|
|
false
|
|
===*/
|
|
|
|
/* When called as a constructor, a Number instance will always have the
|
|
* original Number.prototype regardless of what Number.prototype is now
|
|
* set to. E5 Section 15.7.2.1.
|
|
*
|
|
* However, Number.prototype is not writable or configurable, so this
|
|
* behavior doesn't need to be implemented explicitly; just ensure that
|
|
* Number.prototype is not writable.
|
|
*/
|
|
|
|
var orig_prototype = Number.prototype;
|
|
var repl_prototype = { "foo": "bar" };
|
|
Number.prototype = repl_prototype; /* this write will fail silently */
|
|
|
|
var num = new Number(123);
|
|
print(num.foo);
|
|
print(Object.getPrototypeOf(num) === Number.prototype);
|
|
print(Object.getPrototypeOf(num) === orig_prototype);
|
|
print(Object.getPrototypeOf(num) === repl_prototype);
|
|
|
|
|