Skip to content

Commit

Permalink
Add back an explanatory comment
Browse files Browse the repository at this point in the history
Follow-up to discussion from bazelbuild@8002df1.

PiperOrigin-RevId: 447738275
  • Loading branch information
brandjon authored and copybara-github committed May 10, 2022
1 parent f5ed7d0 commit 4a05464
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,12 @@ public boolean isImmutable() {

@Override
public Label label(String labelString, StarlarkThread thread) throws EvalException {
// The label string is interpeted with respect to the .bzl module containing the call to
// `Label()`. An alternative to this approach that avoids stack inspection is to have each .bzl
// module define its own copy of the `Label()` builtin embedding the module's own name. This
// would lead to peculiarities like foo.bzl being able to call bar.bzl's `Label()` symbol to
// resolve strings as if it were bar.bzl. It also would prevent sharing the same builtins
// environment across .bzl files. Hence, we opt for stack inspection.
BazelModuleContext moduleContext =
BazelModuleContext.of(Module.ofInnermostEnclosingStarlarkFunction(thread));
try {
Expand Down

0 comments on commit 4a05464

Please sign in to comment.