Files
swift-mirror/include/swift/AST/DeclNodes.def

71 lines
2.2 KiB
C++

//===-- DeclNodes.def - Swift Declaration AST Metaprogramming -*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
//
// This file defines macros used for macro-metaprogramming with declarations.
//
//===----------------------------------------------------------------------===//
/// DECL(Id, Parent)
/// If the declaration node is not abstract, its enumerator value is
/// DeclKind::Id. The node's class name is Id##Decl, and the name of
/// its base class (in the Decl hierarchy) is Parent.
/// An abstract declaration node is an abstract base class in the hierarchy;
/// it is never a most-derived type, and it does not have an enumerator in
/// DeclKind.
///
/// Most metaprograms do not care about abstract declarations, so the default
/// is to ignore them.
#ifndef ABSTRACT_DECL
#define ABSTRACT_DECL(Id, Parent)
#endif
/// NAMED_DECL(Id, Parent)
/// Used for subclasses of NamedDecl. The default behavior is to do
/// the same as for Decl.
#ifndef NAMED_DECL
#define NAMED_DECL(Id, Parent) DECL(Id, Parent)
#endif
/// VALUE_DECL(Id, Parent)
/// Used for subclasses of ValueDecl. The default behavior is to do
/// the same as for NamedDecl.
#ifndef VALUE_DECL
#define VALUE_DECL(Id, Parent) NAMED_DECL(Id, Parent)
#endif
/// A convenience for determining the range of declarations. These will always
/// appear immediately after the last member.
#ifndef DECL_RANGE
#define DECL_RANGE(Id, First, Last)
#endif
DECL(Import, Decl)
DECL(Extension, Decl)
DECL(PatternBinding, Decl)
ABSTRACT_DECL(Named, Decl)
ABSTRACT_DECL(Value, Named)
VALUE_DECL(TypeAlias, Decl)
VALUE_DECL(Var, Value)
VALUE_DECL(Func, Value)
VALUE_DECL(OneOfElement, Value)
DECL_RANGE(Value, TypeAlias, OneOfElement)
DECL_RANGE(Named, TypeAlias, OneOfElement)
#undef VALUE_DECL
#undef NAMED_DECL
#undef DECL_RANGE
#undef ABSTRACT_DECL
#undef DECL