mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 10:00:54 +00:00
some classes to test js2 with.
This commit is contained in:
parent
8da0055bc5
commit
8891b0c7ba
28
js/js2/tests/classes.js
Normal file
28
js/js2/tests/classes.js
Normal file
@ -0,0 +1,28 @@
|
||||
class A {
|
||||
static var x = 0;
|
||||
|
||||
static function f()
|
||||
{
|
||||
return A.x++;
|
||||
}
|
||||
}
|
||||
|
||||
class Point3D {
|
||||
var x = 0, y = 0, z = 0;
|
||||
|
||||
function set(x, y, z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
function setX(x) { this.x = x; }
|
||||
function getX() { return this.x; }
|
||||
|
||||
function setY(y) { this.y = y; }
|
||||
function getY() { return this.y; }
|
||||
|
||||
function setZ(z) { this.z = z; }
|
||||
function getZ() { return this.z; }
|
||||
}
|
28
js2/src/tests/classes.js
Normal file
28
js2/src/tests/classes.js
Normal file
@ -0,0 +1,28 @@
|
||||
class A {
|
||||
static var x = 0;
|
||||
|
||||
static function f()
|
||||
{
|
||||
return A.x++;
|
||||
}
|
||||
}
|
||||
|
||||
class Point3D {
|
||||
var x = 0, y = 0, z = 0;
|
||||
|
||||
function set(x, y, z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
function setX(x) { this.x = x; }
|
||||
function getX() { return this.x; }
|
||||
|
||||
function setY(y) { this.y = y; }
|
||||
function getY() { return this.y; }
|
||||
|
||||
function setZ(z) { this.z = z; }
|
||||
function getZ() { return this.z; }
|
||||
}
|
Loading…
Reference in New Issue
Block a user