Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In-lining Resources and Modules when assigned to a variable #4069

Merged

Conversation

miqm
Copy link
Collaborator

@miqm miqm commented Aug 18, 2021

Fixes #1545
Fixes #4331

Contributing a feature

  • I have opened a new issue for the proposal, or commented on an existing one, and ensured that the Bicep maintainers are good with the design of the feature being implemented
  • I have included "Fixes #{issue_number}" in the PR description, so GitHub can link to the issue and close it when the PR is merged
  • I have appropriate test coverage of my new feature

@miqm miqm force-pushed the fix/generating-invalid-variable-1545 branch from 1005ac7 to a8fefd1 Compare August 28, 2021 11:13
Comment on lines 289 to 296
if (this.currentDeclaration is not null)
{
this.shouldInlineCache[this.currentDeclaration] = !shouldNotInline;
if (shouldNotInline)
{
this.shouldNotInlineCache.Add(this.currentDeclaration);
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming this logic is to differentiate the default (don't inline) from an explicit decision not to inline. Rather than introducing 2 caches, would it be possible to modify to use a single cache with an enum - e.g. values to indicate "NotEvaluated", "Inline", "DoNotInline"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added enum with NotInline, Inline and SkipInline values.

Comment on lines -591 to -623
// referencing a module directly should be blocked at an earlier stage - there is nothing great we can codegen here.
Debug.Fail("Found direct module variable access");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created #4320 just to make sure we keep track of the original problem.

Copy link
Member

@anthony-c-martin anthony-c-martin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@anthony-c-martin anthony-c-martin merged commit eae6b03 into Azure:main Sep 13, 2021
@anthony-c-martin anthony-c-martin deleted the fix/generating-invalid-variable-1545 branch September 13, 2021 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants