Skip to content

Commit 94f4927

Browse files
committed
glayzzle#40 do not parse use when it's not a closure
1 parent 78076e5 commit 94f4927

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/parser/function.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,19 @@ module.exports = {
5151
* function_declaration ::= T_FUNCTION '&'? T_STRING '(' parameter_list ')'
5252
* </ebnf>
5353
*/
54-
,read_function_declaration: function(annonymous) {
54+
,read_function_declaration: function(closure) {
5555
var result = this.node('function');
5656
this.expect(this.tok.T_FUNCTION);
5757
var isRef = this.next().is_reference();
5858
var name = false, use = [], returnType = false;
59-
if (!annonymous) {
59+
if (!closure) {
6060
name = this.expect(this.tok.T_STRING).text();
6161
this.next();
6262
}
6363
this.expect('(').next();
6464
var params = this.read_parameter_list();
6565
this.expect(')').next();
66-
if (this.token === this.tok.T_USE) {
66+
if (closure && this.token === this.tok.T_USE) {
6767
use = this.next().expect('(').next().read_list(this.read_lexical_var, ',');
6868
this.expect(')').next();
6969
}

0 commit comments

Comments
 (0)