     return recursionHelper(descriptor, messageStack: [])
   }
 
-  func helper(_ descriptor: Descriptor) -> AnalyseResult {
+  func helper(_ descriptor: Descriptor) -> AnalyzeResult {
     if containsRecursiveSingularField(descriptor) {
       return .useStorage
     }


  /// The message should use storage.
  static let useStorage =
    AnalyseResult(usesStorage: true, costAsField: FieldCost.singleMessageFieldUsingStorage)
}

/// Cache for the `analyse(descriptor:)` results to avoid doing them multiple
/// times.
fileprivate var analysisCache: Dictionary<String,AnalyseResult> = [
  // google.protobuf.Any can be seeded.
  ".google.protobuf.Any": .useStorage,
]

/// Analyse the given descriptor to decide if it should use storage and what
/// the cost of it will be when appearing as a single field in another message.
fileprivate func analyse(descriptor: Descriptor) -> AnalyseResult {
  if let analysis = analysisCache[descriptor.fullName] {
    return analysis
  }

enum MessageStorageDecision {
  /// Compute if a message should use heap based sortage or not.
  static func shouldUseHeapStorage(descriptor: Descriptor) -> Bool {
    return analyze(descriptor: descriptor).usesStorage
  }
}
