Skip to content

Commit 6eb6a9f

Browse files
committed
correctly collect component modifiers
closes #148
1 parent 4577c21 commit 6eb6a9f

File tree

5 files changed

+14
-1
lines changed

5 files changed

+14
-1
lines changed

models/cfscript/CFComponent.cfc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ component {
2727

2828
var tokens = [];
2929
do {
30-
tokens.append(cftokens.next()[1]);
30+
var nextToken = cftokens.next()[1];
31+
if (nextToken.trim().len()) {
32+
tokens.append(nextToken);
33+
}
3134
} while (tokens.last() != 'component' && tokens.last() != 'interface');
3235

3336
var formattedText = tokens.toList(' ');
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
abstract component {
2+
3+
4+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[{}]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
//
2+
abstract component { }

tests/specs/componentSpec.cfc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ component extends=tests.FormatBaseSpec {
1111
it('handles interfaces', function() {
1212
runTests(loadData('interface'));
1313
});
14+
it('handles the abstract keyword correctly', function() {
15+
runTests(loadData('componentAbstract'));
16+
});
1417
});
1518
}
1619

0 commit comments

Comments
 (0)