validatePreviousType method

  1. @override
bool validatePreviousType(
  1. ComputeContext ctx,
  2. String rawBuildingToken,
  3. TokenType? previousTokenType
)
override

Signals the caller is the token type is compatible with the previous type of token.

Implementation

@override
bool validatePreviousType(ComputeContext ctx, String rawBuildingToken,
    TokenType? previousTokenType) {
  if (!super.validatePreviousType(ctx, rawBuildingToken, previousTokenType)) {
    return false;
  }

  final modifier = _getModifier(ctx, rawBuildingToken)!;
  return previousTokenType?.runtimeType == modifier.requiredBefore ||
      modifier.requiredBefore == null;
}