Skip to content

Commit de043a4

Browse files
IgorMinarmatsko
authored andcommitted
refactor(bazel): use getattr instead of hasattr in ng_module.bzl (angular#33765)
getattr improves code readability and makes the code also shorter. PR Close angular#33765
1 parent 955423c commit de043a4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/bazel/src/ng_module.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def _flat_module_out_file(ctx):
129129
Returns:
130130
a basename used for the flat module out (no extension)
131131
"""
132-
if hasattr(ctx.attr, "flat_module_out_file") and ctx.attr.flat_module_out_file:
132+
if getattr(ctx.attr, "flat_module_out_file", False):
133133
return ctx.attr.flat_module_out_file
134134
return "%s_public_index" % ctx.label.name
135135

@@ -149,7 +149,7 @@ def _should_produce_dts_bundle(ctx):
149149
# At the moment we cannot use this with ngtsc compiler since it emits
150150
# import * as ___ from local modules which is not supported
151151
# see: https://github.com/Microsoft/web-build-tools/issues/1029
152-
return _is_view_engine_enabled(ctx) and hasattr(ctx.attr, "bundle_dts") and ctx.attr.bundle_dts
152+
return _is_view_engine_enabled(ctx) and getattr(ctx.attr, "bundle_dts", False)
153153

154154
def _should_produce_r3_symbols_bundle(ctx):
155155
"""Should we produce r3_symbols bundle.

0 commit comments

Comments
 (0)