File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -98,14 +98,17 @@ ExprRule ParseExprRuleJSON(const llvm::json::Object &obj) {
9898 }
9999 }
100100
101- if (auto *rt = obj.getObject (" return_type" ))
101+ if (auto *rt = obj.getObject (" return_type" )) {
102102 ir.return_type = ParseTypeInfoJSON (*rt);
103+ }
103104
104- if (auto ms = obj.getBoolean (" multi_statement" ))
105+ if (auto ms = obj.getBoolean (" multi_statement" )) {
105106 ir.multi_statement = *ms;
107+ }
106108
107- if (auto v = obj.getBoolean (" is_variadic" ))
108- ir.is_variadic = *v;
109+ if (auto v = obj.getBoolean (" is_extern" )) {
110+ ir.is_extern = *v;
111+ }
109112
110113 if (auto *generics = obj.getObject (" generics" )) {
111114 for (auto &[key, val] : *generics) {
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ struct ExprRule {
7070 std::vector<std::vector<std::string>> generics; // "T1" -> ["Ord", "Clone"]
7171 std::vector<BodyFragment> body;
7272 bool multi_statement = false ;
73- bool is_variadic = false ;
73+ bool is_extern = false ;
7474
7575 void dump () const ;
7676 void validate (const std::string &name) const ;
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ pub struct FnIr {
5858 #[ serde( skip_serializing_if = "Option::is_none" ) ]
5959 pub return_type : Option < TypeInfo > ,
6060 #[ serde( skip_serializing_if = "Option::is_none" ) ]
61- pub is_variadic : Option < bool > ,
61+ pub is_extern : Option < bool > ,
6262}
6363
6464impl FnIr {
@@ -107,7 +107,7 @@ impl FnIr {
107107 & format ! ( "Rule {name} generics" ) ,
108108 ) ;
109109 assert ! (
110- self . is_variadic == Some ( true ) || !self . body. is_empty( ) ,
110+ self . is_extern == Some ( true ) || !self . body. is_empty( ) ,
111111 "Rule {name}: body must not be empty"
112112 ) ;
113113 }
Original file line number Diff line number Diff line change @@ -416,12 +416,11 @@ impl<'a> FnIrBuilder<'a> {
416416 . unwrap_or ( Access :: Read )
417417 }
418418
419- fn is_variadic ( & self ) -> bool {
419+ fn is_extern ( & self ) -> bool {
420420 self . fn_item
421- . param_list ( )
422- . into_iter ( )
423- . flat_map ( |pl| pl. params ( ) )
424- . any ( |p| p. dotdotdot_token ( ) . is_some ( ) )
421+ . syntax ( )
422+ . ancestors ( )
423+ . any ( |a| a. kind ( ) == SyntaxKind :: EXTERN_BLOCK )
425424 }
426425
427426 fn returns_mut_ref ( & self ) -> bool {
@@ -525,7 +524,7 @@ impl<'a> FnIrBuilder<'a> {
525524 } ,
526525 multi_statement,
527526 body,
528- is_variadic : self . is_variadic ( ) . then_some ( true ) ,
527+ is_extern : self . is_extern ( ) . then_some ( true ) ,
529528 } ;
530529 ir. validate ( & format ! ( "{}:{}" , path. display( ) , fn_name) ) ;
531530 ir
You can’t perform that action at this time.
0 commit comments