mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[libSyntax] Change OpaqueSyntaxNode to be a const void *
The data of an OpaqueSyntaxNode should never be modified. Also, this allows us to get rid of two const_casts.
This commit is contained in:
@@ -183,7 +183,8 @@ private:
|
||||
auto numValue = serialization::getNumericValue(kind);
|
||||
node.kind = numValue;
|
||||
assert(node.kind == numValue && "syntax kind value is too large");
|
||||
node.layout_data.nodes = elements.data();
|
||||
node.layout_data.nodes =
|
||||
const_cast<const swiftparse_client_node_t *>(elements.data());
|
||||
node.layout_data.nodes_count = elements.size();
|
||||
makeCRange(node.range, range);
|
||||
node.present = true;
|
||||
@@ -302,7 +303,7 @@ swiftparse_client_node_t SynParser::parse(const char *source) {
|
||||
pConsumer = std::make_unique<SynParserDiagConsumer>(*this, bufID);
|
||||
PU.getDiagnosticEngine().addConsumer(*pConsumer);
|
||||
}
|
||||
return PU.parse();
|
||||
return const_cast<swiftparse_client_node_t>(PU.parse());
|
||||
}
|
||||
}
|
||||
//===--- C API ------------------------------------------------------------===//
|
||||
|
||||
Reference in New Issue
Block a user