Skip to content

Commit

Permalink
Use early return
Browse files Browse the repository at this point in the history
  • Loading branch information
0-v-0 committed Jan 7, 2025
1 parent 6523a70 commit cc96434
Showing 1 changed file with 25 additions and 26 deletions.
51 changes: 25 additions & 26 deletions compiler/src/dmd/json.d
Original file line number Diff line number Diff line change
Expand Up @@ -992,35 +992,34 @@ void json_generate(ref Modules modules, ref OutBuffer buf)
// of modules representing their syntax.
json.generateModules(modules);
json.removeComma();
return;
}
else
{
// Generate the new format which is an object where each
// output option is its own field.

json.objectStart();
if (global.params.jsonFieldFlags & JsonFieldFlags.compilerInfo)
{
json.propertyStart("compilerInfo");
json.generateCompilerInfo();
}
if (global.params.jsonFieldFlags & JsonFieldFlags.buildInfo)
{
json.propertyStart("buildInfo");
json.generateBuildInfo();
}
if (global.params.jsonFieldFlags & JsonFieldFlags.modules)
{
json.propertyStart("modules");
json.generateModules(modules);
}
if (global.params.jsonFieldFlags & JsonFieldFlags.semantics)
{
json.propertyStart("semantics");
json.generateSemantics();
}
json.objectEnd();
// Generate the new format which is an object where each
// output option is its own field.

json.objectStart();
if (global.params.jsonFieldFlags & JsonFieldFlags.compilerInfo)
{
json.propertyStart("compilerInfo");
json.generateCompilerInfo();
}
if (global.params.jsonFieldFlags & JsonFieldFlags.buildInfo)
{
json.propertyStart("buildInfo");
json.generateBuildInfo();
}
if (global.params.jsonFieldFlags & JsonFieldFlags.modules)
{
json.propertyStart("modules");
json.generateModules(modules);
}
if (global.params.jsonFieldFlags & JsonFieldFlags.semantics)
{
json.propertyStart("semantics");
json.generateSemantics();
}
json.objectEnd();
}

/**
Expand Down

0 comments on commit cc96434

Please sign in to comment.