コード例 #1
0
ファイル: SILDeclRef.cpp プロジェクト: DeanHao/swift
static unsigned getFuncNaturalUncurryLevel(AnyFunctionRef AFR) {
  assert(AFR.getParameterLists().size() >= 1 && "no arguments for func?!");
  unsigned Level = AFR.getParameterLists().size() - 1;
  // Functions with captures have an extra uncurry level for the capture
  // context.
  if (AFR.getCaptureInfo().hasLocalCaptures())
    Level += 1;
  return Level;
}
コード例 #2
0
ファイル: SILDeclRef.cpp プロジェクト: yasirmcs/swift
static unsigned getFuncNaturalUncurryLevel(AnyFunctionRef AFR) {
  assert(AFR.getParameterLists().size() >= 1 && "no arguments for func?!");
  unsigned Level = AFR.getParameterLists().size() - 1;
  // Functions with captures have an extra uncurry level for the capture
  // context.
  llvm::DenseSet<AnyFunctionRef> visited;
  visited.insert(AFR);
  if (hasLoweredLocalCaptures(AFR, visited))
    Level += 1;
  return Level;
}