Browse Source

Move process.inherits to sys

v0.7.4-release
Ryan Dahl 15 years ago
parent
commit
b021a845f7
  1. 4
      lib/assert.js
  2. 2
      lib/http.js
  3. 9
      lib/sys.js
  4. 10
      src/node.js

4
lib/assert.js

@ -23,7 +23,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// UTILITY // UTILITY
var inherits = require('./sys').inherits;
var pSlice = Array.prototype.slice; var pSlice = Array.prototype.slice;
// 1. The assert module provides functions that throw // 1. The assert module provides functions that throw
@ -47,7 +47,7 @@ assert.AssertionError = function AssertionError (options) {
Error.captureStackTrace(this, stackStartFunction); Error.captureStackTrace(this, stackStartFunction);
} }
}; };
process.inherits(assert.AssertionError, Error); inherits(assert.AssertionError, Error);
assert.AssertionError.prototype.toString = function() { assert.AssertionError.prototype.toString = function() {
if (this.message) { if (this.message) {

2
lib/http.js

@ -1,4 +1,4 @@
var sys = require('sys'); var sys = require('./sys');
var events = require('events'); var events = require('events');
var CRLF = "\r\n"; var CRLF = "\r\n";

9
lib/sys.js

@ -214,5 +214,12 @@ exports.exec = function (command, callback) {
* prototype * prototype
* @param {function} superCtor Constructor function to inherit prototype from * @param {function} superCtor Constructor function to inherit prototype from
*/ */
exports.inherits = process.inherits; exports.inherits = function (ctor, superCtor) {
var tempCtor = function(){};
tempCtor.prototype = superCtor.prototype;
ctor.super_ = superCtor;
ctor.prototype = new tempCtor();
ctor.prototype.constructor = ctor;
};

10
src/node.js

@ -27,6 +27,7 @@ GLOBAL.node = {};
node.createProcess = removed("node.createProcess() has been changed to process.createChildProcess() update your code"); node.createProcess = removed("node.createProcess() has been changed to process.createChildProcess() update your code");
node.exec = removed("process.exec() has moved. Use require('sys') to bring it back."); node.exec = removed("process.exec() has moved. Use require('sys') to bring it back.");
node.inherits = removed("node.inherits() has moved. Use require('sys') to access it."); node.inherits = removed("node.inherits() has moved. Use require('sys') to access it.");
process.inherits = removed("process.inherits() has moved to sys.inherits.");
node.http = {}; node.http = {};
node.http.createServer = removed("node.http.createServer() has moved. Use require('http') to access it."); node.http.createServer = removed("node.http.createServer() has moved. Use require('http') to access it.");
@ -72,15 +73,6 @@ function createInternalModule (id, constructor) {
}; };
process.inherits = function (ctor, superCtor) {
var tempCtor = function(){};
tempCtor.prototype = superCtor.prototype;
ctor.super_ = superCtor;
ctor.prototype = new tempCtor();
ctor.prototype.constructor = ctor;
};
process.createChildProcess = function (file, args, env) { process.createChildProcess = function (file, args, env) {
var child = new process.ChildProcess(); var child = new process.ChildProcess();
args = args || []; args = args || [];

Loading…
Cancel
Save