-
Notifications
You must be signed in to change notification settings - Fork 758
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a6fb5a
commit 0fda714
Showing
9 changed files
with
230 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/Bicep.Decompiler.IntegrationTests/Working/copyloop/main.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
param storageCount int = 2 | ||
|
||
resource storage_id 'Microsoft.Storage/storageAccounts@2019-04-01' = [for i in range(0, storageCount): { | ||
name: '${i}storage${uniqueString(resourceGroup().id)}' | ||
location: resourceGroup().location | ||
sku: { | ||
name: 'Standard_LRS' | ||
} | ||
kind: 'Storage' | ||
properties: {} | ||
}] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Azure.Deployments.Expression.Expressions; | ||
|
||
namespace Bicep.Decompiler | ||
{ | ||
public class ScopedNamingResolver : INamingResolver | ||
{ | ||
private readonly INamingResolver parent; | ||
private readonly ISet<string> scopedVariables; | ||
|
||
public ScopedNamingResolver(INamingResolver parent, IEnumerable<string> scopedVariables) | ||
{ | ||
this.parent = parent; | ||
this.scopedVariables = scopedVariables.ToHashSet(); | ||
} | ||
|
||
public string? TryLookupName(NameType nameType, string desiredName) | ||
{ | ||
if (nameType == NameType.Variable && scopedVariables.Contains(desiredName)) | ||
{ | ||
return desiredName; | ||
} | ||
|
||
return parent.TryLookupName(nameType, desiredName); | ||
} | ||
|
||
public string? TryLookupResourceName(string? typeString, LanguageExpression nameExpression) | ||
=> parent.TryLookupResourceName(typeString, nameExpression); | ||
|
||
public string? TryRequestName(NameType nameType, string desiredName) | ||
=> throw new NotImplementedException(); | ||
|
||
public string? TryRequestResourceName(string typeString, LanguageExpression nameExpression) | ||
=> throw new NotImplementedException(); | ||
} | ||
} |
Oops, something went wrong.