Set parents for child elements when assigned using properties
This commit is contained in:
parent
ad7ddd8a33
commit
abddd5e1d6
Binary file not shown.
File diff suppressed because it is too large
Load diff
|
|
@ -232,7 +232,26 @@ namespace NodeGenerator
|
||||||
}
|
}
|
||||||
";
|
";
|
||||||
|
|
||||||
public static readonly string field_template=
|
public static readonly string syntax_prop_template =
|
||||||
|
@" ///<summary>
|
||||||
|
///help_context
|
||||||
|
///</summary>
|
||||||
|
public property_type property_name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return field_name;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
field_name=value;
|
||||||
|
if (field_name != null)
|
||||||
|
field_name.Parent = this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
";
|
||||||
|
|
||||||
|
public static readonly string field_template=
|
||||||
@" protected field_type field_name;";
|
@" protected field_type field_name;";
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -268,7 +287,17 @@ namespace NodeGenerator
|
||||||
|
|
||||||
public static string create_property(string property_type,string property_name,string field_name,string help_context)
|
public static string create_property(string property_type,string property_name,string field_name,string help_context)
|
||||||
{
|
{
|
||||||
var w = change_words(prop_template, new string_repl("property_type", property_type),
|
return CreatePropertyFromTemplate(prop_template, property_type, property_name, field_name, help_context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string create_property_for_syntax_node_field(string property_type, string property_name, string field_name, string help_context)
|
||||||
|
{
|
||||||
|
return CreatePropertyFromTemplate(syntax_prop_template, property_type, property_name, field_name, help_context);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string CreatePropertyFromTemplate(string template, string property_type, string property_name, string field_name, string help_context)
|
||||||
|
{
|
||||||
|
var w = change_words(template, new string_repl("property_type", property_type),
|
||||||
new string_repl("property_name", property_name), new string_repl("field_name", field_name),
|
new string_repl("property_name", property_name), new string_repl("field_name", field_name),
|
||||||
new string_repl("help_context", help_context));
|
new string_repl("help_context", help_context));
|
||||||
/*if (property_type.ToLower().StartsWith("list<"))
|
/*if (property_type.ToLower().StartsWith("list<"))
|
||||||
|
|
@ -276,7 +305,7 @@ namespace NodeGenerator
|
||||||
w = change_words(w, new string_repl("get", "protected get"));
|
w = change_words(w, new string_repl("get", "protected get"));
|
||||||
}*/
|
}*/
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string create_field(string field_type,string field_name)
|
public static string create_field(string field_type,string field_name)
|
||||||
{
|
{
|
||||||
|
|
@ -568,9 +597,9 @@ namespace NodeGenerator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void generate_code_property(StreamWriter sw,node_info ni,HelpStorage hst)
|
public virtual void generate_code_property(StreamWriter sw,node_info ni,HelpStorage hst)
|
||||||
{
|
{
|
||||||
string prop=text_consts.create_property(field_type_name,property_name,field_code_name,
|
string prop=text_consts.create_property_for_syntax_node_field(field_type_name,property_name,field_code_name,
|
||||||
hst.get_help_context(ni.node_name+"."+field_name).help_context);
|
hst.get_help_context(ni.node_name+"."+field_name).help_context);
|
||||||
//sw.WriteLine();
|
//sw.WriteLine();
|
||||||
sw.WriteLine(prop);
|
sw.WriteLine(prop);
|
||||||
|
|
@ -875,6 +904,14 @@ namespace NodeGenerator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void generate_code_property(StreamWriter sw, node_info ni, HelpStorage hst)
|
||||||
|
{
|
||||||
|
string prop = text_consts.create_property(field_type_name, property_name, field_code_name,
|
||||||
|
hst.get_help_context(ni.node_name + "." + field_name).help_context);
|
||||||
|
|
||||||
|
sw.WriteLine(prop);
|
||||||
|
}
|
||||||
|
|
||||||
public override void generate_clone_code(NodeWriter writer, string variableName)
|
public override void generate_clone_code(NodeWriter writer, string variableName)
|
||||||
{
|
{
|
||||||
var destination = variableName + "." + field_name;
|
var destination = variableName + "." + field_name;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
<UpgradeBackupLocation>
|
<UpgradeBackupLocation>
|
||||||
</UpgradeBackupLocation>
|
</UpgradeBackupLocation>
|
||||||
<OldToolsVersion>3.5</OldToolsVersion>
|
<OldToolsVersion>3.5</OldToolsVersion>
|
||||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||||
<TargetFrameworkProfile />
|
<TargetFrameworkProfile />
|
||||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
<PublishUrl>опубликовать\</PublishUrl>
|
<PublishUrl>опубликовать\</PublishUrl>
|
||||||
|
|
@ -93,6 +93,27 @@
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<BaseAddress>285212672</BaseAddress>
|
||||||
|
<FileAlignment>4096</FileAlignment>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||||
|
<OutputPath>bin\x86\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<BaseAddress>285212672</BaseAddress>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<FileAlignment>4096</FileAlignment>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Irony, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ca48ace7223ead47, processorArchitecture=MSIL">
|
<Reference Include="Irony, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ca48ace7223ead47, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
|
@ -210,6 +231,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="app.config" />
|
<None Include="app.config" />
|
||||||
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||||
|
|
|
||||||
|
|
@ -64,4 +64,7 @@
|
||||||
</StartWorkingDirectory>
|
</StartWorkingDirectory>
|
||||||
<StartWithIE>false</StartWithIE>
|
<StartWithIE>false</StartWithIE>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||||
|
<StartWithIE>true</StartWithIE>
|
||||||
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 2010
|
# Visual Studio 15
|
||||||
|
VisualStudioVersion = 15.0.27428.2037
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NodesGenerator", "NodesGenerator.csproj", "{1C27130D-43F9-40F9-A7EF-DED5F6C6C9CB}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NodesGenerator", "NodesGenerator.csproj", "{1C27130D-43F9-40F9-A7EF-DED5F6C6C9CB}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NodesGenerator_old", "NodesGenerator_old\NodesGenerator_old.csproj", "{172069EF-39F3-44C6-86C0-01CEC24691B6}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NodesGenerator_old", "NodesGenerator_old\NodesGenerator_old.csproj", "{172069EF-39F3-44C6-86C0-01CEC24691B6}"
|
||||||
|
|
@ -8,19 +10,32 @@ EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Release|x86 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{1C27130D-43F9-40F9-A7EF-DED5F6C6C9CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{1C27130D-43F9-40F9-A7EF-DED5F6C6C9CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{1C27130D-43F9-40F9-A7EF-DED5F6C6C9CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{1C27130D-43F9-40F9-A7EF-DED5F6C6C9CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{1C27130D-43F9-40F9-A7EF-DED5F6C6C9CB}.Debug|x86.ActiveCfg = Debug|x86
|
||||||
|
{1C27130D-43F9-40F9-A7EF-DED5F6C6C9CB}.Debug|x86.Build.0 = Debug|x86
|
||||||
{1C27130D-43F9-40F9-A7EF-DED5F6C6C9CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{1C27130D-43F9-40F9-A7EF-DED5F6C6C9CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{1C27130D-43F9-40F9-A7EF-DED5F6C6C9CB}.Release|Any CPU.Build.0 = Release|Any CPU
|
{1C27130D-43F9-40F9-A7EF-DED5F6C6C9CB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{1C27130D-43F9-40F9-A7EF-DED5F6C6C9CB}.Release|x86.ActiveCfg = Release|x86
|
||||||
|
{1C27130D-43F9-40F9-A7EF-DED5F6C6C9CB}.Release|x86.Build.0 = Release|x86
|
||||||
{172069EF-39F3-44C6-86C0-01CEC24691B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{172069EF-39F3-44C6-86C0-01CEC24691B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{172069EF-39F3-44C6-86C0-01CEC24691B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{172069EF-39F3-44C6-86C0-01CEC24691B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{172069EF-39F3-44C6-86C0-01CEC24691B6}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{172069EF-39F3-44C6-86C0-01CEC24691B6}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
{172069EF-39F3-44C6-86C0-01CEC24691B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{172069EF-39F3-44C6-86C0-01CEC24691B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{172069EF-39F3-44C6-86C0-01CEC24691B6}.Release|Any CPU.Build.0 = Release|Any CPU
|
{172069EF-39F3-44C6-86C0-01CEC24691B6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{172069EF-39F3-44C6-86C0-01CEC24691B6}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{172069EF-39F3-44C6-86C0-01CEC24691B6}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {B9166D14-8866-4DD1-97FC-5EAC353191C9}
|
||||||
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -1,3 +1,3 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/></startup></configuration>
|
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup></configuration>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue