mirror of
				https://github.com/Ed94/gencpp.git
				synced 2025-10-30 22:40:54 -07:00 
			
		
		
		
	Added a new AST member NextVar to be used for comma separated variable support.
				
					
				
			Interface adding has been adjusted to use ParentType->Next. Using the AST_Class->Next was bad since that breaks the linked list a body AST would have used for traversal.
This commit is contained in:
		| @@ -103,7 +103,7 @@ String AST::to_string() | |||||||
|  |  | ||||||
| 					result.append_fmt( "%S : %s %S", Name, access_level, ParentType ); | 					result.append_fmt( "%S : %s %S", Name, access_level, ParentType ); | ||||||
|  |  | ||||||
| 					CodeType interface = Next->cast< CodeType >(); | 					CodeType interface = ParentType->Next->cast< CodeType >(); | ||||||
| 					if ( interface ) | 					if ( interface ) | ||||||
| 						result.append( "\n" ); | 						result.append( "\n" ); | ||||||
|  |  | ||||||
| @@ -703,7 +703,7 @@ String AST::to_string() | |||||||
|  |  | ||||||
| 					result.append_fmt( "%S : %s %S", Name, access_level, ParentType ); | 					result.append_fmt( "%S : %s %S", Name, access_level, ParentType ); | ||||||
|  |  | ||||||
| 					CodeType interface = Next->cast< CodeType >(); | 					CodeType interface = ParentType->Next->cast< CodeType >(); | ||||||
| 					if ( interface ) | 					if ( interface ) | ||||||
| 						result.append( "\n" ); | 						result.append( "\n" ); | ||||||
|  |  | ||||||
| @@ -924,6 +924,35 @@ String AST::to_string() | |||||||
|  |  | ||||||
| 		case Variable: | 		case Variable: | ||||||
| 		{ | 		{ | ||||||
|  | 			if ( Parent && Parent->Type == Variable ) | ||||||
|  | 			{ | ||||||
|  | 				// Its a comma-separated variable ( a NextVar ) | ||||||
|  |  | ||||||
|  | 				if ( Specs ) | ||||||
|  | 					result.append_fmt( "%S ", Specs->to_string() ); | ||||||
|  |  | ||||||
|  | 				result.append( Name ); | ||||||
|  |  | ||||||
|  | 				if ( ArrExpr ) | ||||||
|  | 				{ | ||||||
|  | 					result.append_fmt( "[ %S ]", ArrExpr->to_string() ); | ||||||
|  |  | ||||||
|  | 					AST* next_arr_expr = ArrExpr->Next; | ||||||
|  | 					while ( next_arr_expr ) | ||||||
|  | 					{ | ||||||
|  | 						result.append_fmt( "[ %S ]", next_arr_expr->to_string() ); | ||||||
|  | 						next_arr_expr = next_arr_expr->Next; | ||||||
|  | 					} | ||||||
|  | 				} | ||||||
|  |  | ||||||
|  | 				if ( Value ) | ||||||
|  | 					result.append_fmt( " = %S", Value->to_string() ); | ||||||
|  |  | ||||||
|  | 				// Keep the chain going... | ||||||
|  | 				if ( NextVar ) | ||||||
|  | 					result.append_fmt( ", %S", NextVar->to_string() ); | ||||||
|  | 			} | ||||||
|  |  | ||||||
| 			if ( bitfield_is_equal( u32, ModuleFlags, ModuleFlag::Export )) | 			if ( bitfield_is_equal( u32, ModuleFlags, ModuleFlag::Export )) | ||||||
| 				result.append( "export " ); | 				result.append( "export " ); | ||||||
|  |  | ||||||
| @@ -955,6 +984,9 @@ String AST::to_string() | |||||||
| 				if ( Value ) | 				if ( Value ) | ||||||
| 					result.append_fmt( " = %S", Value->to_string() ); | 					result.append_fmt( " = %S", Value->to_string() ); | ||||||
|  |  | ||||||
|  | 				if ( NextVar ) | ||||||
|  | 					result.append_fmt( ", %S", NextVar->to_string() ); | ||||||
|  |  | ||||||
| 				if ( InlineCmt ) | 				if ( InlineCmt ) | ||||||
| 					result.append_fmt(";  %S", InlineCmt->Content); | 					result.append_fmt(";  %S", InlineCmt->Content); | ||||||
| 				else | 				else | ||||||
| @@ -964,7 +996,7 @@ String AST::to_string() | |||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			if ( BitfieldSize ) | 			if ( BitfieldSize ) | ||||||
| 				result.append_fmt( "%S %S : %S;", ValueType->to_string(), Name, BitfieldSize->to_string() ); | 				result.append_fmt( "%S %S : %S", ValueType->to_string(), Name, BitfieldSize->to_string() ); | ||||||
|  |  | ||||||
| 			else if ( ValueType->ArrExpr ) | 			else if ( ValueType->ArrExpr ) | ||||||
| 			{ | 			{ | ||||||
| @@ -976,12 +1008,18 @@ String AST::to_string() | |||||||
| 					result.append_fmt( "[ %S ]", next_arr_expr->to_string() ); | 					result.append_fmt( "[ %S ]", next_arr_expr->to_string() ); | ||||||
| 					next_arr_expr = next_arr_expr->Next; | 					next_arr_expr = next_arr_expr->Next; | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
| 				result.append( ";" ); |  | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			else | 			else | ||||||
| 				result.append_fmt( "%S %S;", ValueType->to_string(), Name ); | 				result.append_fmt( "%S %S", ValueType->to_string(), Name ); | ||||||
|  |  | ||||||
|  | 			if ( Value ) | ||||||
|  | 				result.append_fmt( " = %S", Value->to_string() ); | ||||||
|  |  | ||||||
|  | 			if ( NextVar ) | ||||||
|  | 				result.append_fmt( ", %S", NextVar->to_string() ); | ||||||
|  |  | ||||||
|  | 			result.append( ";" ); | ||||||
|  |  | ||||||
| 			if ( InlineCmt ) | 			if ( InlineCmt ) | ||||||
| 				result.append_fmt("  %S", InlineCmt->Content); | 				result.append_fmt("  %S", InlineCmt->Content); | ||||||
| @@ -1508,6 +1546,7 @@ bool AST::is_equal( AST* other ) | |||||||
| 			check_member_ast( Value ); | 			check_member_ast( Value ); | ||||||
| 			check_member_ast( Attributes ); | 			check_member_ast( Attributes ); | ||||||
| 			check_member_ast( Specs ); | 			check_member_ast( Specs ); | ||||||
|  | 			check_member_ast( NextVar ); | ||||||
|  |  | ||||||
| 			return true; | 			return true; | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -229,22 +229,19 @@ struct AST | |||||||
| 	union { | 	union { | ||||||
| 		struct | 		struct | ||||||
| 		{ | 		{ | ||||||
| 			union { |  | ||||||
| 			AST*      InlineCmt;       // Class, Constructor, Destructor, Enum, Friend, Functon, Operator, OpCast, Struct, Typedef, Using, Variable | 			AST*      InlineCmt;       // Class, Constructor, Destructor, Enum, Friend, Functon, Operator, OpCast, Struct, Typedef, Using, Variable | ||||||
| 				AST*  SpecsFuncSuffix; // Only used with typenames, to store the function suffix if typename is function signature. |  | ||||||
| 			}; |  | ||||||
| 			AST*      Attributes;      // Class, Enum, Function, Struct, Typedef, Union, Using, Variable | 			AST*      Attributes;      // Class, Enum, Function, Struct, Typedef, Union, Using, Variable | ||||||
| 			AST*      Specs;           // Destructor, Function, Operator, Typename, Variable | 			AST*      Specs;           // Destructor, Function, Operator, Typename, Variable | ||||||
| 			union { | 			union { | ||||||
| 				AST*  InitializerList; // Constructor | 				AST*  InitializerList; // Constructor | ||||||
| 				AST*  ParentType;      // Class, Struct, ParentType->Next has a possible list of interfaces. | 				AST*  ParentType;      // Class, Struct, ParentType->Next has a possible list of interfaces. | ||||||
| 				AST*  ReturnType;      // Function, Operator | 				AST*  ReturnType;      // Function, Operator, Typename | ||||||
| 				AST*  UnderlyingType;  // Enum, Typedef | 				AST*  UnderlyingType;  // Enum, Typedef | ||||||
| 				AST*  ValueType;       // Parameter, Variable | 				AST*  ValueType;       // Parameter, Variable | ||||||
| 			}; | 			}; | ||||||
| 			union { | 			union { | ||||||
| 				AST*  BitfieldSize;    // Varaiable (Class/Struct Data Member) | 				AST*  BitfieldSize;    // Variable (Class/Struct Data Member) | ||||||
| 				AST*  Params;          // Constructor, Function, Operator, Template | 				AST*  Params;          // Constructor, Function, Operator, Template, Typename | ||||||
| 			}; | 			}; | ||||||
| 			union { | 			union { | ||||||
| 				AST*  ArrExpr;          // Typename | 				AST*  ArrExpr;          // Typename | ||||||
| @@ -252,6 +249,10 @@ struct AST | |||||||
| 				AST*  Declaration;      // Friend, Template | 				AST*  Declaration;      // Friend, Template | ||||||
| 				AST*  Value;            // Parameter, Variable | 				AST*  Value;            // Parameter, Variable | ||||||
| 			}; | 			}; | ||||||
|  | 			union { | ||||||
|  | 				AST*  NextVar;          // Variable; Possible way to handle comma separated variables declarations. ( , NextVar->Specs NextVar->Name NextVar->ArrExpr = NextVar->Value ) | ||||||
|  | 				AST*  SpecsFuncSuffix;  // Only used with typenames, to store the function suffix if typename is function signature. | ||||||
|  | 			}; | ||||||
| 		}; | 		}; | ||||||
| 		StringCached  Content;          // Attributes, Comment, Execution, Include | 		StringCached  Content;          // Attributes, Comment, Execution, Include | ||||||
| 		SpecifierT    ArrSpecs[AST::ArrSpecs_Cap]; // Specifiers | 		SpecifierT    ArrSpecs[AST::ArrSpecs_Cap]; // Specifiers | ||||||
| @@ -284,29 +285,30 @@ struct AST_POD | |||||||
| 	union { | 	union { | ||||||
| 		struct | 		struct | ||||||
| 		{ | 		{ | ||||||
| 			union { |  | ||||||
| 			AST*      InlineCmt;       // Class, Constructor, Destructor, Enum, Friend, Functon, Operator, OpCast, Struct, Typedef, Using, Variable | 			AST*      InlineCmt;       // Class, Constructor, Destructor, Enum, Friend, Functon, Operator, OpCast, Struct, Typedef, Using, Variable | ||||||
| 				AST*  SpecsFuncSuffix; // Only used with typenames, to store the function suffix if typename is function signature. | 			AST*      Attributes;      // Class, Enum, Function, Struct, Typedef, Union, Using, Variable | ||||||
| 			}; | 			AST*      Specs;           // Destructor, Function, Operator, Typename, Variable | ||||||
| 			AST*      Attributes;      // Class, Enum, Function, Struct, Typename, Union, Using, Variable |  | ||||||
| 			AST*      Specs;           // Function, Operator, Typename, Variable |  | ||||||
| 			union { | 			union { | ||||||
| 				AST*  InitializerList; // Constructor | 				AST*  InitializerList; // Constructor | ||||||
| 				AST*  ParentType;      // Class, Struct, ParentType->Next has a possible list of interfaces. | 				AST*  ParentType;      // Class, Struct, ParentType->Next has a possible list of interfaces. | ||||||
| 				AST*  ReturnType;      // Function, Operator | 				AST*  ReturnType;      // Function, Operator, Typename | ||||||
| 				AST*  UnderlyingType;  // Enum, Typedef | 				AST*  UnderlyingType;  // Enum, Typedef | ||||||
| 				AST*  ValueType;       // Parameter, Variable | 				AST*  ValueType;       // Parameter, Variable | ||||||
| 			}; | 			}; | ||||||
| 			union { | 			union { | ||||||
| 				AST*  BitfieldSize;    // Varaiable (Class/Struct Data Member) | 				AST*  BitfieldSize;    // Variable (Class/Struct Data Member) | ||||||
| 				AST*  Params;          // Function, Operator, Template | 				AST*  Params;          // Constructor, Function, Operator, Template, Typename | ||||||
| 			}; | 			}; | ||||||
| 			union { | 			union { | ||||||
| 				AST*  ArrExpr;         // Type Symbol | 				AST*  ArrExpr;          // Typename | ||||||
| 				AST*  Body;             // Class, Constructr, Destructor, Enum, Function, Namespace, Struct, Union | 				AST*  Body;             // Class, Constructr, Destructor, Enum, Function, Namespace, Struct, Union | ||||||
| 				AST*  Declaration;      // Friend, Template | 				AST*  Declaration;      // Friend, Template | ||||||
| 				AST*  Value;            // Parameter, Variable | 				AST*  Value;            // Parameter, Variable | ||||||
| 			}; | 			}; | ||||||
|  | 			union { | ||||||
|  | 				AST*  NextVar;          // Variable; Possible way to handle comma separated variables declarations. ( , NextVar->Specs NextVar->Name NextVar->ArrExpr = NextVar->Value ) | ||||||
|  | 				AST*  SpecsFuncSuffix;  // Only used with typenames, to store the function suffix if typename is function signature. | ||||||
|  | 			}; | ||||||
| 		}; | 		}; | ||||||
| 		StringCached  Content;         // Attributes, Comment, Execution, Include | 		StringCached  Content;         // Attributes, Comment, Execution, Include | ||||||
| 		SpecifierT    ArrSpecs[AST::ArrSpecs_Cap]; // Specifiers | 		SpecifierT    ArrSpecs[AST::ArrSpecs_Cap]; // Specifiers | ||||||
|   | |||||||
| @@ -68,6 +68,7 @@ struct AST_Class | |||||||
| 			CodeType        ParentType; | 			CodeType        ParentType; | ||||||
| 			char 	        _PAD_PARAMS_[ sizeof(AST*) ]; | 			char 	        _PAD_PARAMS_[ sizeof(AST*) ]; | ||||||
| 			CodeBody        Body; | 			CodeBody        Body; | ||||||
|  | 			char 	        _PAD_PROPERTIES_2_[ sizeof(AST*) ]; | ||||||
| 		}; | 		}; | ||||||
| 	}; | 	}; | ||||||
| 	CodeType                Last; | 	CodeType                Last; | ||||||
| @@ -93,6 +94,7 @@ struct AST_Constructor | |||||||
| 			Code           InitializerList; | 			Code           InitializerList; | ||||||
| 			CodeParam      Params; | 			CodeParam      Params; | ||||||
| 			Code           Body; | 			Code           Body; | ||||||
|  | 			char 		   _PAD_PROPERTIES_2_ [ sizeof(AST*) * 2 ]; | ||||||
| 		}; | 		}; | ||||||
| 	}; | 	}; | ||||||
| 	Code              Prev; | 	Code              Prev; | ||||||
| @@ -132,6 +134,7 @@ struct AST_Destructor | |||||||
| 			CodeSpecifiers Specs; | 			CodeSpecifiers Specs; | ||||||
| 			char           _PAD_PROPERTIES_2_ [ sizeof(AST*) * 2 ]; | 			char           _PAD_PROPERTIES_2_ [ sizeof(AST*) * 2 ]; | ||||||
| 			Code           Body; | 			Code           Body; | ||||||
|  | 			char 		   _PAD_PROPERTIES_3_ [ sizeof(AST*) ]; | ||||||
| 		}; | 		}; | ||||||
| 	}; | 	}; | ||||||
| 	Code                   Prev; | 	Code                   Prev; | ||||||
| @@ -156,6 +159,7 @@ struct AST_Enum | |||||||
| 			CodeType       UnderlyingType; | 			CodeType       UnderlyingType; | ||||||
| 			char	       _PAD_PARAMS_[ sizeof(AST*) ]; | 			char	       _PAD_PARAMS_[ sizeof(AST*) ]; | ||||||
| 			CodeBody       Body; | 			CodeBody       Body; | ||||||
|  | 			char 	       _PAD_PROPERTIES_2_[ sizeof(AST*) ]; | ||||||
| 		}; | 		}; | ||||||
| 	}; | 	}; | ||||||
| 	Code                   Prev; | 	Code                   Prev; | ||||||
| @@ -193,6 +197,7 @@ struct AST_Extern | |||||||
| 		{ | 		{ | ||||||
| 			char      _PAD_PROPERTIES_[ sizeof(AST*) * 5 ]; | 			char      _PAD_PROPERTIES_[ sizeof(AST*) * 5 ]; | ||||||
| 			CodeBody  Body; | 			CodeBody  Body; | ||||||
|  | 			char      _PAD_PROPERTIES_2_[ sizeof(AST*) ]; | ||||||
| 		}; | 		}; | ||||||
| 	}; | 	}; | ||||||
| 	Code              Prev; | 	Code              Prev; | ||||||
| @@ -230,6 +235,7 @@ struct AST_Friend | |||||||
| 			CodeComment InlineCmt; | 			CodeComment InlineCmt; | ||||||
| 			char        _PAD_PROPERTIES_[ sizeof(AST*) * 4 ]; | 			char        _PAD_PROPERTIES_[ sizeof(AST*) * 4 ]; | ||||||
| 			Code        Declaration; | 			Code        Declaration; | ||||||
|  | 			char 	    _PAD_PROPERTIES_2_[ sizeof(AST*) ]; | ||||||
| 		}; | 		}; | ||||||
| 	}; | 	}; | ||||||
| 	Code              Prev; | 	Code              Prev; | ||||||
| @@ -254,6 +260,7 @@ struct AST_Fn | |||||||
| 			CodeType        ReturnType; | 			CodeType        ReturnType; | ||||||
| 			CodeParam 	    Params; | 			CodeParam 	    Params; | ||||||
| 			CodeBody        Body; | 			CodeBody        Body; | ||||||
|  | 			char 	        _PAD_PROPERTIES_ [ sizeof(AST*) ]; | ||||||
| 		}; | 		}; | ||||||
| 	}; | 	}; | ||||||
| 	Code                    Prev; | 	Code                    Prev; | ||||||
| @@ -288,6 +295,7 @@ struct AST_NS | |||||||
| 		struct { | 		struct { | ||||||
| 			char 	  _PAD_PROPERTIES_[ sizeof(AST*) * 5 ]; | 			char 	  _PAD_PROPERTIES_[ sizeof(AST*) * 5 ]; | ||||||
| 			CodeBody  Body; | 			CodeBody  Body; | ||||||
|  | 			char 	  _PAD_PROPERTIES_2_[ sizeof(AST*) ]; | ||||||
| 		}; | 		}; | ||||||
| 	}; | 	}; | ||||||
| 	Code              Prev; | 	Code              Prev; | ||||||
| @@ -313,6 +321,7 @@ struct AST_Operator | |||||||
| 			CodeType        ReturnType; | 			CodeType        ReturnType; | ||||||
| 			CodeParam 	    Params; | 			CodeParam 	    Params; | ||||||
| 			CodeBody        Body; | 			CodeBody        Body; | ||||||
|  | 			char 	        _PAD_PROPERTIES_ [ sizeof(AST*) ]; | ||||||
| 		}; | 		}; | ||||||
| 	}; | 	}; | ||||||
| 	Code                    Prev; | 	Code                    Prev; | ||||||
| @@ -338,6 +347,7 @@ struct AST_OpCast | |||||||
| 			CodeType       ValueType; | 			CodeType       ValueType; | ||||||
| 			char 	       _PAD_PROPERTIES_2_[ sizeof(AST*) ]; | 			char 	       _PAD_PROPERTIES_2_[ sizeof(AST*) ]; | ||||||
| 			CodeBody       Body; | 			CodeBody       Body; | ||||||
|  | 			char 	       _PAD_PROPERTIES_3_[ sizeof(AST*) ]; | ||||||
| 		}; | 		}; | ||||||
| 	}; | 	}; | ||||||
| 	Code              Prev; | 	Code              Prev; | ||||||
| @@ -360,6 +370,7 @@ struct AST_Param | |||||||
| 			CodeType  ValueType; | 			CodeType  ValueType; | ||||||
| 			char 	  _PAD_PROPERTIES_[ sizeof(AST*) ]; | 			char 	  _PAD_PROPERTIES_[ sizeof(AST*) ]; | ||||||
| 			Code      Value; | 			Code      Value; | ||||||
|  | 			char 	  _PAD_PROPERTIES_3_[ sizeof(AST*) ]; | ||||||
| 		}; | 		}; | ||||||
| 	}; | 	}; | ||||||
| 	CodeParam         Last; | 	CodeParam         Last; | ||||||
| @@ -431,6 +442,7 @@ struct AST_Struct | |||||||
| 			CodeType       ParentType; | 			CodeType       ParentType; | ||||||
| 			char 	       _PAD_PARAMS_[ sizeof(AST*) ]; | 			char 	       _PAD_PARAMS_[ sizeof(AST*) ]; | ||||||
| 			CodeBody       Body; | 			CodeBody       Body; | ||||||
|  | 			char 	       _PAD_PROPERTIES_2_[ sizeof(AST*) ]; | ||||||
| 		}; | 		}; | ||||||
| 	}; | 	}; | ||||||
| 	CodeType               Last; | 	CodeType               Last; | ||||||
| @@ -453,6 +465,7 @@ struct AST_Template | |||||||
| 			char 	       _PAD_PROPERTIES_[ sizeof(AST*) * 4 ]; | 			char 	       _PAD_PROPERTIES_[ sizeof(AST*) * 4 ]; | ||||||
| 			CodeParam 	   Params; | 			CodeParam 	   Params; | ||||||
| 			Code           Declaration; | 			Code           Declaration; | ||||||
|  | 			char 	       _PAD_PROPERTIES_2_[ sizeof(AST*) ]; | ||||||
| 		}; | 		}; | ||||||
| 	}; | 	}; | ||||||
| 	Code                   Prev; | 	Code                   Prev; | ||||||
| @@ -472,12 +485,13 @@ struct AST_Type | |||||||
| 		char 		       _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ]; | 		char 		       _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ]; | ||||||
| 		struct | 		struct | ||||||
| 		{ | 		{ | ||||||
| 			CodeSpecifiers SpecsFuncSuffix; // Only used for function signatures | 			char           _PAD_INLINE_CMT_[ sizeof(AST*) ]; | ||||||
| 			CodeAttributes Attributes; | 			CodeAttributes Attributes; | ||||||
| 			CodeSpecifiers Specs; | 			CodeSpecifiers Specs; | ||||||
| 			CodeType       ReturnType;      // Only used for function signatures | 			CodeType       ReturnType;      // Only used for function signatures | ||||||
| 			CodeParam      Params;          // Only used for function signatures | 			CodeParam      Params;          // Only used for function signatures | ||||||
| 			Code           ArrExpr; | 			Code           ArrExpr; | ||||||
|  | 			CodeSpecifiers SpecsFuncSuffix; // Only used for function signatures | ||||||
| 		}; | 		}; | ||||||
| 	}; | 	}; | ||||||
| 	Code                   Prev; | 	Code                   Prev; | ||||||
| @@ -500,7 +514,7 @@ struct AST_Typedef | |||||||
| 			CodeComment    InlineCmt; | 			CodeComment    InlineCmt; | ||||||
| 			char 	       _PAD_PROPERTIES_[ sizeof(AST*) * 2 ]; | 			char 	       _PAD_PROPERTIES_[ sizeof(AST*) * 2 ]; | ||||||
| 			Code           UnderlyingType; | 			Code           UnderlyingType; | ||||||
| 			char 	       _PAD_PROPERTIES_2_[ sizeof(AST*) * 2 ]; | 			char 	       _PAD_PROPERTIES_2_[ sizeof(AST*) * 3 ]; | ||||||
| 		}; | 		}; | ||||||
| 	}; | 	}; | ||||||
| 	Code                   Prev; | 	Code                   Prev; | ||||||
| @@ -524,6 +538,7 @@ struct AST_Union | |||||||
| 			CodeAttributes Attributes; | 			CodeAttributes Attributes; | ||||||
| 			char 	       _PAD_PROPERTIES_[ sizeof(AST*) * 3 ]; | 			char 	       _PAD_PROPERTIES_[ sizeof(AST*) * 3 ]; | ||||||
| 			CodeBody       Body; | 			CodeBody       Body; | ||||||
|  | 			char 	       _PAD_PROPERTIES_2_[ sizeof(AST*) ]; | ||||||
| 		}; | 		}; | ||||||
| 	}; | 	}; | ||||||
| 	Code                   Prev; | 	Code                   Prev; | ||||||
| @@ -547,7 +562,7 @@ struct AST_Using | |||||||
| 			CodeAttributes  Attributes; | 			CodeAttributes  Attributes; | ||||||
| 			char 	        _PAD_SPECS_     [ sizeof(AST*) ]; | 			char 	        _PAD_SPECS_     [ sizeof(AST*) ]; | ||||||
| 			CodeType        UnderlyingType; | 			CodeType        UnderlyingType; | ||||||
| 			char 	        _PAD_PROPERTIES_[ sizeof(AST*) * 2 ]; | 			char 	        _PAD_PROPERTIES_[ sizeof(AST*) * 3 ]; | ||||||
| 		}; | 		}; | ||||||
| 	}; | 	}; | ||||||
| 	Code                    Prev; | 	Code                    Prev; | ||||||
| @@ -573,6 +588,7 @@ struct AST_Var | |||||||
| 			CodeType       ValueType; | 			CodeType       ValueType; | ||||||
| 			Code           BitfieldSize; | 			Code           BitfieldSize; | ||||||
| 			Code           Value; | 			Code           Value; | ||||||
|  | 			CodeVar		   NextVar; | ||||||
| 		}; | 		}; | ||||||
| 	}; | 	}; | ||||||
| 	Code                   Prev; | 	Code                   Prev; | ||||||
|   | |||||||
| @@ -67,15 +67,21 @@ Code& Code::operator ++() | |||||||
|  |  | ||||||
| void CodeClass::add_interface( CodeType type ) | void CodeClass::add_interface( CodeType type ) | ||||||
| { | { | ||||||
| 	if ( ! ast->Next ) | 	CodeType possible_slot = ast->ParentType; | ||||||
|  | 	if ( possible_slot.ast ) | ||||||
| 	{ | 	{ | ||||||
| 		ast->Next = type; | 		// Were adding an interface to parent type, so we need to make sure the parent type is public. | ||||||
| 		ast->Last = ast->Next; | 		ast->ParentAccess = AccessSpec::Public; | ||||||
| 		return; | 		// If your planning on adding a proper parent, | ||||||
|  | 		// then you'll need to move this over to ParentType->next and update ParentAccess accordingly. | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	ast->Next->Next = type; | 	while ( possible_slot.ast != nullptr ) | ||||||
| 	ast->Last       = ast->Next->Next; | 	{ | ||||||
|  | 		possible_slot.ast = (AST_Type*) possible_slot->Next.ast; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	possible_slot.ast = type.ast; | ||||||
| } | } | ||||||
|  |  | ||||||
| void CodeParam::append( CodeParam other ) | void CodeParam::append( CodeParam other ) | ||||||
| @@ -129,14 +135,21 @@ CodeParam& CodeParam::operator ++() | |||||||
|  |  | ||||||
| void CodeStruct::add_interface( CodeType type ) | void CodeStruct::add_interface( CodeType type ) | ||||||
| { | { | ||||||
| 	if ( ! ast->Next ) | 	CodeType possible_slot = ast->ParentType; | ||||||
|  | 	if ( possible_slot.ast ) | ||||||
| 	{ | 	{ | ||||||
| 		ast->Next = type; | 		// Were adding an interface to parent type, so we need to make sure the parent type is public. | ||||||
| 		ast->Last = ast->Next; | 		ast->ParentAccess = AccessSpec::Public; | ||||||
|  | 		// If your planning on adding a proper parent, | ||||||
|  | 		// then you'll need to move this over to ParentType->next and update ParentAccess accordingly. | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	ast->Next->Next = type; | 	while ( possible_slot.ast != nullptr ) | ||||||
| 	ast->Last       = ast->Next->Next; | 	{ | ||||||
|  | 		possible_slot.ast = (AST_Type*) possible_slot->Next.ast; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	possible_slot.ast = type.ast; | ||||||
| } | } | ||||||
|  |  | ||||||
| CodeBody def_body( CodeT type ) | CodeBody def_body( CodeT type ) | ||||||
|   | |||||||
| @@ -4963,6 +4963,7 @@ CodeType parse_type( bool* typedef_is_function ) | |||||||
| 			SpecifierT spec = ESpecifier::to_type( currtok ); | 			SpecifierT spec = ESpecifier::to_type( currtok ); | ||||||
|  |  | ||||||
| 			if (   spec != ESpecifier::Const | 			if (   spec != ESpecifier::Const | ||||||
|  | 				// TODO : Add support for NoExcept | ||||||
| 				// && spec != ESpecifier::NoExcept | 				// && spec != ESpecifier::NoExcept | ||||||
| 				&& spec != ESpecifier::RValue ) | 				&& spec != ESpecifier::RValue ) | ||||||
| 			{ | 			{ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user