mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[IDE] Introduce semantic annotation functionality and test.
Swift SVN r8618
This commit is contained in:
54
include/swift/IDE/SemanticSourceEntity.h
Normal file
54
include/swift/IDE/SemanticSourceEntity.h
Normal file
@@ -0,0 +1,54 @@
|
||||
//===- SemanticSourceEntity.h - Routines for semantic source info ---------===//
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
//
|
||||
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See http://swift.org/LICENSE.txt for license information
|
||||
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef SWIFT_IDE_SEMANTIC_SOURCE_ENTITY_H
|
||||
#define SWIFT_IDE_SEMANTIC_SOURCE_ENTITY_H
|
||||
|
||||
#include "swift/Basic/SourceLoc.h"
|
||||
#include <functional>
|
||||
|
||||
namespace swift {
|
||||
class Decl;
|
||||
class ValueDecl;
|
||||
|
||||
namespace ide {
|
||||
|
||||
struct SemanticSourceEntity {
|
||||
CharSourceRange Range;
|
||||
ValueDecl *Dcl;
|
||||
bool IsRef;
|
||||
};
|
||||
|
||||
/// A function receiving SemanticSourceEntity objects.
|
||||
/// \returns true to continue receiving the next object, false to stop.
|
||||
typedef std::function<bool(SemanticSourceEntity AnnoTok)>
|
||||
SemanticEntityReceiverFn;
|
||||
|
||||
/// Walks the provided declarations and passes SemanticSourceEntities to the
|
||||
/// \c Receiver.
|
||||
///
|
||||
/// The entities are given in source-order, as long as the \c Decls array is
|
||||
/// already in source-order.
|
||||
///
|
||||
/// \param Decls the array of declarations to traverse.
|
||||
///
|
||||
/// \param Receiver the function receiving the entities.
|
||||
///
|
||||
/// \returns true if all the entities were passed to the receiver, false if
|
||||
/// the receiver stopped by returning false.
|
||||
bool findSemanticSourceEntities(ArrayRef<Decl*> Decls,
|
||||
SemanticEntityReceiverFn Receiver);
|
||||
|
||||
} // namespace ide
|
||||
} // namespace swift
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user