@@ -296,15 +296,6 @@ void PropertyMap::addProperty(
296296 props->addProperty (property, Context,
297297 inducedRules, Debug.contains (DebugFlags::ConcreteUnification));
298298}
299- void PropertyMap::dump (llvm::raw_ostream &out) const {
300- out << " Property map: {\n " ;
301- for (const auto &props : Entries) {
302- out << " " ;
303- props->dump (out);
304- out << " \n " ;
305- }
306- out << " }\n " ;
307- }
308299
309300// / Build the property map from all rules of the form T.[p] => T, where
310301// / [p] is a property symbol.
@@ -318,19 +309,18 @@ void PropertyMap::dump(llvm::raw_ostream &out) const {
318309// / left hand side has a length exceeding \p maxDepth.
319310// /
320311// / Otherwise, the status is CompletionResult::Success.
321- std::pair<RewriteSystem::CompletionResult, unsigned >
322- RewriteSystem::buildPropertyMap (PropertyMap &map,
323- unsigned maxIterations,
324- unsigned maxDepth) {
325- map.clear ();
312+ std::pair<CompletionResult, unsigned >
313+ PropertyMap::buildPropertyMap (unsigned maxIterations,
314+ unsigned maxDepth) {
315+ clear ();
326316
327317 // PropertyMap::addRule() requires that shorter rules are added
328318 // before longer rules, so that it can perform lookups on suffixes and call
329319 // PropertyBag::copyPropertiesFrom(). However, we don't have to perform a
330320 // full sort by term order here; a bucket sort by term length suffices.
331321 SmallVector<std::vector<std::pair<Term, Symbol>>, 4 > properties;
332322
333- for (const auto &rule : Rules ) {
323+ for (const auto &rule : System. getRules () ) {
334324 if (rule.isSimplified ())
335325 continue ;
336326
@@ -355,34 +345,44 @@ RewriteSystem::buildPropertyMap(PropertyMap &map,
355345
356346 for (const auto &bucket : properties) {
357347 for (auto pair : bucket) {
358- map. addProperty (pair.first , pair.second , inducedRules);
348+ addProperty (pair.first , pair.second , inducedRules);
359349 }
360350 }
361351
362352 // We collect terms with fully concrete types so that we can re-use them
363353 // to tie off recursion in the next step.
364- map. computeConcreteTypeInDomainMap ();
354+ computeConcreteTypeInDomainMap ();
365355
366356 // Now, we merge concrete type rules with conformance rules, by adding
367357 // relations between associated type members of type parameters with
368358 // the concrete type witnesses in the concrete type's conformance.
369- map. concretizeNestedTypesFromConcreteParents (inducedRules);
359+ concretizeNestedTypesFromConcreteParents (inducedRules);
370360
371361 // Some of the induced rules might be trivial; only count the induced rules
372362 // where the left hand side is not already equivalent to the right hand side.
373363 unsigned addedNewRules = 0 ;
374364 for (auto pair : inducedRules) {
375- if (addRule (pair.first , pair.second )) {
365+ if (System. addRule (pair.first , pair.second )) {
376366 ++addedNewRules;
377367
378- const auto &newRule = Rules .back ();
379- if (newRule.getLHS (). size () > maxDepth)
368+ const auto &newRule = System. getRules () .back ();
369+ if (newRule.getDepth () > maxDepth)
380370 return std::make_pair (CompletionResult::MaxDepth, addedNewRules);
381371 }
382372 }
383373
384- if (Rules .size () > maxIterations)
374+ if (System. getRules () .size () > maxIterations)
385375 return std::make_pair (CompletionResult::MaxIterations, addedNewRules);
386376
387377 return std::make_pair (CompletionResult::Success, addedNewRules);
378+ }
379+
380+ void PropertyMap::dump (llvm::raw_ostream &out) const {
381+ out << " Property map: {\n " ;
382+ for (const auto &props : Entries) {
383+ out << " " ;
384+ props->dump (out);
385+ out << " \n " ;
386+ }
387+ out << " }\n " ;
388388}
0 commit comments