Skip to content

Commit 247cd8c

Browse files
committed
Fixes TypeError for classes in FF strict mode.
"Due to the new semantics of JavaScript's strict mode, CoffeeScript no longer guarantees that constructor functions have names in all runtimes. See #2052 for discussion." jashkenas/coffeescript#2052
1 parent 57b844f commit 247cd8c

2 files changed

Lines changed: 1 addition & 6 deletions

File tree

src/CoffeeScript/Nodes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static function utility_extends()
6262
. 'function ctor() { '
6363
. 'this.constructor = child; '
6464
. '} '
65-
. 'ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; '
65+
. 'ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; '
6666
. 'return child; '
6767
. '}';
6868
}

src/CoffeeScript/yy/Class.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,6 @@ function compile_node($options)
121121
array_unshift($this->body->expressions, $this->ctor);
122122
}
123123

124-
if ($decl)
125-
{
126-
array_unshift($this->body->expressions, yy('Assign', yy('Value', yy('Literal', $name), array(yy('Access', yy('Literal', 'name')))), yy('Literal', "'{$name}'")));
127-
}
128-
129124
$this->body->expressions[] = $lname;
130125
$this->body->expressions = array_merge($this->directives, $this->body->expressions);
131126

0 commit comments

Comments
 (0)