mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Use this node to capture the argument name and its source location in the AST. We're only building these in one place at the moment; the rest will be updated soon. Swift SVN r16581
106 lines
3.6 KiB
C++
106 lines
3.6 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
|
|
|
|
/// VALUE_DECL(Id, Parent)
|
|
/// Used for subclasses of ValueDecl. The default behavior is to do
|
|
/// the same as for Decl.
|
|
#ifndef VALUE_DECL
|
|
#define VALUE_DECL(Id, Parent) DECL(Id, Parent)
|
|
#endif
|
|
|
|
/// OPERATOR_DECL(Id, Parent)
|
|
/// Used for subclasses of OperatorDecl. The default behavior is to do
|
|
/// the same as for Decl.
|
|
#ifndef OPERATOR_DECL
|
|
#define OPERATOR_DECL(Id, Parent) DECL(Id, Parent)
|
|
#endif
|
|
|
|
/// NOMINAL_TYPE_DECL(Id, Parent)
|
|
/// Used for subclasses of NominalTypeDecl. The default behavior is
|
|
/// to do the same as for ValueDecl.
|
|
#ifndef NOMINAL_TYPE_DECL
|
|
#define NOMINAL_TYPE_DECL(Id, Parent) VALUE_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)
|
|
DECL(EnumCase, Decl)
|
|
DECL(TopLevelCode, Decl)
|
|
DECL(IfConfig, Decl)
|
|
|
|
ABSTRACT_DECL(Operator, Decl)
|
|
OPERATOR_DECL(InfixOperator, OperatorDecl)
|
|
OPERATOR_DECL(PrefixOperator, OperatorDecl)
|
|
OPERATOR_DECL(PostfixOperator, OperatorDecl)
|
|
DECL_RANGE(Operator, InfixOperator, PostfixOperator)
|
|
|
|
ABSTRACT_DECL(Value, Decl)
|
|
ABSTRACT_DECL(Type, ValueDecl)
|
|
VALUE_DECL(TypeAlias, TypeDecl)
|
|
ABSTRACT_DECL(AbstractTypeParam, TypeDecl)
|
|
VALUE_DECL(GenericTypeParam, AbstractTypeParamDecl)
|
|
VALUE_DECL(AssociatedType, AbstractTypeParamDecl)
|
|
DECL_RANGE(AbstractTypeParam, GenericTypeParam, AssociatedType)
|
|
ABSTRACT_DECL(NominalType, TypeDecl)
|
|
NOMINAL_TYPE_DECL(Enum, NominalTypeDecl)
|
|
NOMINAL_TYPE_DECL(Struct, NominalTypeDecl)
|
|
NOMINAL_TYPE_DECL(Class, NominalTypeDecl)
|
|
NOMINAL_TYPE_DECL(Protocol, NominalTypeDecl)
|
|
DECL_RANGE(NominalType, Enum, Protocol)
|
|
DECL_RANGE(Type, TypeAlias, Protocol)
|
|
ABSTRACT_DECL(AbstractStorage, ValueDecl)
|
|
VALUE_DECL(Var, AbstractStorageDecl)
|
|
VALUE_DECL(Param, VarDecl)
|
|
VALUE_DECL(Subscript, AbstractStorageDecl)
|
|
DECL_RANGE(AbstractStorage, Var, Subscript)
|
|
ABSTRACT_DECL(AbstractFunction, ValueDecl)
|
|
VALUE_DECL(Constructor, AbstractFunctionDecl)
|
|
VALUE_DECL(Destructor, AbstractFunctionDecl)
|
|
VALUE_DECL(Func, AbstractFunctionDecl)
|
|
DECL_RANGE(AbstractFunction, Constructor, Func)
|
|
VALUE_DECL(EnumElement, ValueDecl)
|
|
DECL_RANGE(Value, TypeAlias, EnumElement)
|
|
|
|
#undef NOMINAL_TYPE_DECL
|
|
#undef VALUE_DECL
|
|
#undef DECL_RANGE
|
|
#undef ABSTRACT_DECL
|
|
#undef DECL
|