From 3f6eceac77e03d61e3ea41c229c565edb1d30b96 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Mon, 15 Feb 2010 13:55:28 -0500 Subject: [PATCH] whoops, screwed up the definition order in the inheritance example --- documentation/coffee/super.coffee | 8 +++--- documentation/index.html.erb | 6 ---- documentation/js/super.js | 16 +++++------ index.html | 46 ++++++++++++++----------------- 4 files changed, 32 insertions(+), 44 deletions(-) diff --git a/documentation/coffee/super.coffee b/documentation/coffee/super.coffee index 25f57985..0f726513 100644 --- a/documentation/coffee/super.coffee +++ b/documentation/coffee/super.coffee @@ -7,22 +7,22 @@ Snake: (name) -> @name: name this +Snake extends Animal + Snake::move: -> alert "Slithering..." super 5 -Snake extends Animal - Horse: (name) -> @name: name this +Horse extends Animal + Horse::move: -> alert "Galloping..." super 45 -Horse extends Animal - sam: new Snake "Sammy the Python" tom: new Horse "Tommy the Palomino" diff --git a/documentation/index.html.erb b/documentation/index.html.erb index e481b541..1bc234d3 100644 --- a/documentation/index.html.erb +++ b/documentation/index.html.erb @@ -680,12 +680,6 @@ print reverse 'tpircseeffoc' Ivan Nemytchenko, that embeds snippets of CoffeeScript within your HAML templates. -
  • - CoffeePot
    - An implementation of CoffeeScript, written in CoffeeScript, by - Tim Caswell. Compiles just - a limited subset at this point. -
  • Change Log

    diff --git a/documentation/js/super.js b/documentation/js/super.js index 96ae4eda..dab20866 100644 --- a/documentation/js/super.js +++ b/documentation/js/super.js @@ -8,28 +8,28 @@ this.name = name; return this; }; - Snake.prototype.move = function move() { - alert("Slithering..."); - return Snake.__superClass__.move.call(this, 5); - }; __a = function(){}; __a.prototype = Animal.prototype; Snake.__superClass__ = Animal.prototype; Snake.prototype = new __a(); Snake.prototype.constructor = Snake; + Snake.prototype.move = function move() { + alert("Slithering..."); + return Snake.__superClass__.move.call(this, 5); + }; Horse = function Horse(name) { this.name = name; return this; }; - Horse.prototype.move = function move() { - alert("Galloping..."); - return Horse.__superClass__.move.call(this, 45); - }; __b = function(){}; __b.prototype = Animal.prototype; Horse.__superClass__ = Animal.prototype; Horse.prototype = new __b(); Horse.prototype.constructor = Horse; + Horse.prototype.move = function move() { + alert("Galloping..."); + return Horse.__superClass__.move.call(this, 45); + }; sam = new Snake("Sammy the Python"); tom = new Horse("Tommy the Palomino"); sam.move(); diff --git a/index.html b/index.html index 9bb7bf70..dada482a 100644 --- a/index.html +++ b/index.html @@ -1137,22 +1137,22 @@ speed = (typeof speed !== "undefined" && speed !== null) ? speed : 140; @name: name this +Snake extends Animal + Snake::move: -> alert "Slithering..." super 5 -Snake extends Animal - Horse: (name) -> @name: name this +Horse extends Animal + Horse::move: -> alert "Galloping..." super 45 -Horse extends Animal - sam: new Snake "Sammy the Python" tom: new Horse "Tommy the Palomino" @@ -1171,28 +1171,28 @@ Snake = function this.name = name; return this; }; -Snake.prototype.move = function move() { - alert("Slithering..."); - return Snake.__superClass__.move.call(this, 5); -}; __a = function(){}; __a.prototype = Animal.prototype; Snake.__superClass__ = Animal.prototype; Snake.prototype = new __a(); Snake.prototype.constructor = Snake; +Snake.prototype.move = function move() { + alert("Slithering..."); + return Snake.__superClass__.move.call(this, 5); +}; Horse = function Horse(name) { this.name = name; return this; }; -Horse.prototype.move = function move() { - alert("Galloping..."); - return Horse.__superClass__.move.call(this, 45); -}; __b = function(){}; __b.prototype = Animal.prototype; Horse.__superClass__ = Animal.prototype; Horse.prototype = new __b(); Horse.prototype.constructor = Horse; +Horse.prototype.move = function move() { + alert("Galloping..."); + return Horse.__superClass__.move.call(this, 45); +}; sam = new Snake("Sammy the Python"); tom = new Horse("Tommy the Palomino"); sam.move(); @@ -1206,28 +1206,28 @@ Snake = function Snake(name) { this.name = name; return this; }; -Snake.prototype.move = function move() { - alert("Slithering..."); - return Snake.__superClass__.move.call(this, 5); -}; __a = function(){}; __a.prototype = Animal.prototype; Snake.__superClass__ = Animal.prototype; Snake.prototype = new __a(); Snake.prototype.constructor = Snake; +Snake.prototype.move = function move() { + alert("Slithering..."); + return Snake.__superClass__.move.call(this, 5); +}; Horse = function Horse(name) { this.name = name; return this; }; -Horse.prototype.move = function move() { - alert("Galloping..."); - return Horse.__superClass__.move.call(this, 45); -}; __b = function(){}; __b.prototype = Animal.prototype; Horse.__superClass__ = Animal.prototype; Horse.prototype = new __b(); Horse.prototype.constructor = Horse; +Horse.prototype.move = function move() { + alert("Galloping..."); + return Horse.__superClass__.move.call(this, 45); +}; sam = new Snake("Sammy the Python"); tom = new Horse("Tommy the Palomino"); sam.move(); @@ -1551,12 +1551,6 @@ html = &q Ivan Nemytchenko, that embeds snippets of CoffeeScript within your HAML templates. -
  • - CoffeePot
    - An implementation of CoffeeScript, written in CoffeeScript, by - Tim Caswell. Compiles just - a limited subset at this point. -
  • Change Log