Skip to content

Commit bc73c3c

Browse files
committed
glayzzle#29 impl const visibility on interfaces
1 parent 4570b4b commit bc73c3c

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

src/parser/class.js

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -321,20 +321,6 @@ module.exports = {
321321
continue;
322322
}
323323

324-
// check constant
325-
if (this.token == this.tok.T_CONST) {
326-
var node = this.node();
327-
var constants = this.read_constant_list();
328-
this.expect(';').nextWithComments();
329-
if (comment) {
330-
(this.locations ? comment[3] : comment).push(constants);
331-
constants = comment;
332-
comment = false;
333-
}
334-
constants = node.apply(this, constants);
335-
result.constants.push(constants);
336-
continue;
337-
}
338324

339325
// prepare here position (to avoid bad position on locations)
340326
if (this.locations) {
@@ -348,8 +334,26 @@ module.exports = {
348334
// read member flags
349335
var flags = this.read_member_flags(true);
350336

337+
// check constant
338+
if (this.token == this.tok.T_CONST) {
339+
var constants = this.read_constant_list();
340+
this.expect(';').nextWithComments();
341+
342+
for(var i = 0; i < constants.length; i++) {
343+
var constant = constants[i];
344+
(this.locations ? constant[3] : constant).push(flags);
345+
if (comment) {
346+
var buffer = comment.slice(0);
347+
(this.locations ? buffer[3] : buffer).push(constant);
348+
constant = buffer;
349+
}
350+
result.constants.push(constant);
351+
}
352+
353+
}
354+
351355
// reads a function
352-
if (this.token === this.tok.T_FUNCTION) {
356+
else if (this.token === this.tok.T_FUNCTION) {
353357
// reads a function
354358
var method = this.read_function_declaration().concat(
355359
[flags]

0 commit comments

Comments
 (0)