mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-26 23:31:18 +00:00
Deduplicate class export and fix identifier error in ExportNameScopeToCpp (#7550)
Added method_alias.carbon test so that the class export code in `ExportNameScopeToCpp` is tested. Refactored `ExportClassToCpp` so that `ExportNameScopeToCpp` can reuse that code. Moved the `identifier_info` code in `ExportNameScopeToCpp` into the namespace block, because the name scope's name ID is not valid for classes. Added a call to `CompleteType` for classes exported via `ExportNameScopeToCpp`, otherwise a "queried property of class with no definition" assert is later reached (when adding methods) in the call chain `BuildCppToCarbonThunkDecl` -> `DeclContext::addHiddenDecl` -> `CXXRecordDecl::addedMember` -> `CXXRecordDecl::data`.
This commit is contained in:
1 parent
0b0918274c
commit
33bd953a2e
2 files changed
+78
-46
No files matched your search
@@ -88,3 +88,17 @@ void F() {
|
||||
Carbon::C().M();
|
||||
}
|
||||
''';
|
||||
|
||||
// --- method_alias.carbon
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class A {
|
||||
fn F();
|
||||
}
|
||||
|
||||
alias G = A.F;
|
||||
|
||||
inline Cpp '''
|
||||
void call() { Carbon::G(); }
|
||||
''';
|
||||
Reference in new issue
Block a user