Skip to content

Commit

Permalink
[generator] generate only generatable code. (#73)
Browse files Browse the repository at this point in the history
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=43883

The bug describes the situation where generator attempts to generate code
for non-generatable referenced types from assemblies.
  • Loading branch information
atsushieno authored and jonpryor committed Sep 9, 2016
1 parent d9c675a commit 72a0fea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tools/generator/ClassGen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ void GenMethods (StreamWriter sw, string indent, CodeGenerationOptions opt)
var overridens = defaultMethods.Where (m => overrides.Where (_ => _.Name == m.Name && _.JniSignature == m.JniSignature)
.Any (mm => mm.DeclaringType.GetAllDerivedInterfaces ().Contains (m.DeclaringType)));

foreach (Method m in Methods.Concat (defaultMethods.Except (overridens))) {
foreach (Method m in Methods.Concat (defaultMethods.Except (overridens)).Where (m => m.DeclaringType.IsGeneratable)) {
bool virt = m.IsVirtual;
m.IsVirtual = !IsFinal && virt;
if (m.IsAbstract && !m.IsInterfaceDefaultMethodOverride && !m.IsInterfaceDefaultMethod)
Expand Down
3 changes: 2 additions & 1 deletion tools/generator/CodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@ public static void Run (CodeGeneratorOptions options)
new NamespaceMapping (gens).Generate (opt, gen_info);

foreach (IGeneratable gen in gens)
gen.Generate (opt, gen_info);
if (gen.IsGeneratable)
gen.Generate (opt, gen_info);

ClassGen.GenerateTypeRegistrations (opt, gen_info);
ClassGen.GenerateEnumList (gen_info);
Expand Down

0 comments on commit 72a0fea

Please sign in to comment.