예제 #1
0
// static
VariantMatcher Registry::constructBoundMatcher(StringRef MatcherName,
                                               const SourceRange &NameRange,
                                               StringRef BindID,
                                               ArrayRef<ParserValue> Args,
                                               Diagnostics *Error) {
  VariantMatcher Out = constructMatcher(MatcherName, NameRange, Args, Error);
  if (Out.isNull()) return Out;

  llvm::Optional<DynTypedMatcher> Result = Out.getSingleMatcher();
  if (Result.hasValue()) {
    llvm::Optional<DynTypedMatcher> Bound = Result->tryBind(BindID);
    if (Bound.hasValue()) {
      return VariantMatcher::SingleMatcher(*Bound);
    }
  }
  Error->addError(NameRange, Error->ET_RegistryNotBindable);
  return VariantMatcher();
}
예제 #2
0
// static
VariantMatcher Registry::constructBoundMatcher(StringRef MatcherName,
                                               const SourceRange &NameRange,
                                               StringRef BindID,
                                               ArrayRef<ParserValue> Args,
                                               Diagnostics *Error) {
  VariantMatcher Out = constructMatcher(MatcherName, NameRange, Args, Error);
  if (Out.isNull()) return Out;

  const DynTypedMatcher *Result;
  if (Out.getSingleMatcher(Result)) {
    OwningPtr<DynTypedMatcher> Bound(Result->tryBind(BindID));
    if (Bound) {
      return VariantMatcher::SingleMatcher(*Bound);
    }
  }
  Error->addError(NameRange, Error->ET_RegistryNotBindable);
  return VariantMatcher();
}