@@ -177,7 +177,7 @@ class MustachioParser {
177
177
///
178
178
/// [_index] should be at the character immediately following the `#`
179
179
/// character which opens a possible section tag.
180
- _TagParseResult _parseSection ({@required invert}) {
180
+ _TagParseResult _parseSection ({@required bool invert}) {
181
181
var parsedKey = _parseKey ();
182
182
if (parsedKey.type == _KeyParseResultType .notKey) {
183
183
return _TagParseResult .notTag;
@@ -407,6 +407,7 @@ enum _TagParseResultType {
407
407
}
408
408
409
409
/// The result of attempting to parse a Mustache tag.
410
+ @immutable
410
411
class _TagParseResult {
411
412
final _TagParseResultType type;
412
413
@@ -432,15 +433,15 @@ class _TagParseResult {
432
433
433
434
/// A [_TagParseResult] representing that EOF was reached, without parsing a
434
435
/// tag.
435
- static _TagParseResult endOfFile =
436
+ static final _TagParseResult endOfFile =
436
437
_TagParseResult (_TagParseResultType .endOfFile, null , null );
437
438
438
439
/// A [_TagParseResult] representing that a tag was not parsed.
439
- static _TagParseResult notTag =
440
+ static final _TagParseResult notTag =
440
441
_TagParseResult (_TagParseResultType .notTag, null , null );
441
442
442
443
/// A [_TagParseResult] representing that a comment tag was parsed.
443
- static _TagParseResult commentTag =
444
+ static final _TagParseResult commentTag =
444
445
_TagParseResult (_TagParseResultType .commentTag, null , null );
445
446
}
446
447
@@ -452,12 +453,13 @@ enum _KeyParseResultType {
452
453
}
453
454
454
455
/// The result of attempting to parse a Mustache key.
456
+ @immutable
455
457
class _KeyParseResult {
456
458
final _KeyParseResultType type;
457
459
458
460
final List <String > names;
459
461
460
- _KeyParseResult ._(this .type, this .names);
462
+ const _KeyParseResult ._(this .type, this .names);
461
463
462
464
factory _KeyParseResult (_KeyParseResultType type, String key) {
463
465
if (key == '.' ) {
@@ -469,12 +471,12 @@ class _KeyParseResult {
469
471
470
472
/// A [_KeyParseResult] representing that EOF was reached, without parsing a
471
473
/// key.
472
- static _KeyParseResult endOfFile =
473
- _KeyParseResult ._(_KeyParseResultType .endOfFile, null );
474
+ static const _KeyParseResult endOfFile =
475
+ _KeyParseResult ._(_KeyParseResultType .endOfFile, [] );
474
476
475
477
/// A [_KeyParseResult] representing that a key was not parsed.
476
- static _KeyParseResult notKey =
477
- _KeyParseResult ._(_KeyParseResultType .notKey, null );
478
+ static const _KeyParseResult notKey =
479
+ _KeyParseResult ._(_KeyParseResultType .notKey, [] );
478
480
479
481
/// The reconstituted key, with periods separating names.
480
482
String get joinedNames => names.join ('.' );
0 commit comments