1- //*********************************************************//
2- // Copyright (c) Microsoft. All rights reserved.
3- //
4- // Apache 2.0 License
5- //
6- // You may obtain a copy of the License at
7- // http://www.apache.org/licenses/LICENSE-2.0
8- //
9- // Unless required by applicable law or agreed to in writing, software
10- // distributed under the License is distributed on an "AS IS" BASIS,
11- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12- // implied. See the License for the specific language governing
13- // permissions and limitations under the License.
14- //
15- //*********************************************************//
16-
17- using System . Diagnostics ;
18- using System . Threading ;
19-
20- namespace Microsoft . NodejsTools . Analysis . Analyzer {
21- class RequireAnalysisUnit : AnalysisUnit {
22- private string _dependency ;
23- private ModuleTree _tree ;
24- private ModuleTable _table ;
25-
26- internal RequireAnalysisUnit ( ModuleTree tree , ModuleTable table , ProjectEntry entry , string dependency ) : base ( entry . Tree , entry . EnvironmentRecord ) {
27- _tree = tree ;
28- _table = table ;
29- _dependency = dependency ;
30- }
31-
32- internal override void AnalyzeWorker ( DDG ddg , CancellationToken cancel ) {
33- ModuleTree module = _table . RequireModule ( this , _dependency , _tree ) ;
34- if ( module == null ) {
35- return ;
36- }
37-
38- AddChildVisibilitiesExcludingNodeModules ( module ) ;
39- }
40-
41- private void AddChildVisibilitiesExcludingNodeModules ( ModuleTree moduleTree ) {
1+ //*********************************************************//
2+ // Copyright (c) Microsoft. All rights reserved.
3+ //
4+ // Apache 2.0 License
5+ //
6+ // You may obtain a copy of the License at
7+ // http://www.apache.org/licenses/LICENSE-2.0
8+ //
9+ // Unless required by applicable law or agreed to in writing, software
10+ // distributed under the License is distributed on an "AS IS" BASIS,
11+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12+ // implied. See the License for the specific language governing
13+ // permissions and limitations under the License.
14+ //
15+ //*********************************************************//
16+
17+ using System . Diagnostics ;
18+ using System . Threading ;
19+
20+ namespace Microsoft . NodejsTools . Analysis . Analyzer {
21+ class RequireAnalysisUnit : AnalysisUnit {
22+ private string _dependency ;
23+ private ModuleTree _tree ;
24+ private ModuleTable _table ;
25+
26+ internal RequireAnalysisUnit ( ModuleTree tree , ModuleTable table , ProjectEntry entry , string dependency ) : base ( entry . Tree , entry . EnvironmentRecord ) {
27+ _tree = tree ;
28+ _table = table ;
29+ _dependency = dependency ;
30+ }
31+
32+ internal override void AnalyzeWorker ( DDG ddg , CancellationToken cancel ) {
33+ ModuleTree module = _table . RequireModule ( this , _dependency , _tree ) ;
34+ if ( module == null ) {
35+ return ;
36+ }
37+
38+ AddChildVisibilitiesExcludingNodeModules ( module ) ;
39+ }
40+
41+ private void AddChildVisibilitiesExcludingNodeModules ( ModuleTree moduleTree ) {
4242 foreach ( var childTree in moduleTree . GetChildrenExcludingNodeModules ( ) ) {
4343 Debug . Assert ( childTree . Name != AnalysisConstants . NodeModulesFolder ) ;
4444 if ( childTree . ProjectEntry == null ) {
4545 AddChildVisibilitiesExcludingNodeModules ( childTree ) ;
4646 } else {
4747 _table . AddVisibility ( _tree , childTree . ProjectEntry ) ;
4848 }
49- }
50- }
51- }
49+ }
50+ }
51+ }
5252}
0 commit comments