mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
By now ParsedRawSyntaxNode does not have any knowledge about deferred node data anymore, which frees up SyntaxParseActions (and, in particular its sublass SyntaxTreeCreator) to perform optimisations to more efficiently create and record deferred nodes.
44 lines
1.5 KiB
C++
44 lines
1.5 KiB
C++
%{
|
|
from gyb_syntax_support import *
|
|
# -*- mode: C++ -*-
|
|
# Ignore the following admonition; it applies to the resulting .cpp file only
|
|
}%
|
|
//// Automatically Generated From ParsedSyntaxNodes.cpp.gyb.
|
|
//// Do Not Edit Directly!
|
|
//===--- ParsedSyntaxNodes.cpp - Parsed Syntax Node definitions -----------===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "swift/Parse/ParsedSyntaxNodes.h"
|
|
#include "swift/Syntax/SyntaxNodes.h"
|
|
|
|
using namespace swift;
|
|
using namespace swift::syntax;
|
|
|
|
% for node in SYNTAX_NODES:
|
|
% for child in node.children:
|
|
% if child.is_optional:
|
|
Optional<Parsed${child.type_name}>
|
|
Parsed${node.name}::getDeferred${child.name}(const SyntaxParsingContext *SyntaxContext) {
|
|
auto RawChild = getRaw().getDeferredChild(${node.name}::Cursor::${child.name}, SyntaxContext);
|
|
if (RawChild.isNull())
|
|
return None;
|
|
return Parsed${child.type_name} {RawChild.copyDeferred()};
|
|
}
|
|
% else:
|
|
Parsed${child.type_name} Parsed${node.name}::getDeferred${child.name}(const SyntaxParsingContext *SyntaxContext) {
|
|
return Parsed${child.type_name} {getRaw().getDeferredChild(${node.name}::Cursor::${child.name}, SyntaxContext).copyDeferred()};
|
|
}
|
|
% end
|
|
|
|
% end
|
|
% end
|