Updates referencesource to .NET 4.7
[mono.git] / mcs / class / referencesource / System.Data.SqlXml / System / Xml / Xsl / XsltOld / TemplateBaseAction.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="TemplateBaseAction.cs" company="Microsoft">
3 //     Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>                                                                
5 // <owner current="true" primary="true">Microsoft</owner>
6 //------------------------------------------------------------------------------
7
8 namespace System.Xml.Xsl.XsltOld {
9     using Res = System.Xml.Utils.Res;
10     using System;
11     using System.Diagnostics;
12     using System.Collections;
13     using System.Xml;
14     using System.Xml.XPath;
15     using System.Globalization;
16
17     // RootAction and TemplateActions have a litle in common -- they are responsible for variable allocation
18     // TemplateBaseAction -- implenemts this shared behavior
19
20     internal abstract class TemplateBaseAction : ContainerAction {
21         protected int variableCount;      // space to allocate on frame for variables
22         private   int variableFreeSlot;   // compile time counter responsiable for variable placement logic
23
24         public int AllocateVariableSlot() {
25             // Variable placement logic. Optimized
26             int thisSlot = this.variableFreeSlot;
27             this.variableFreeSlot ++;
28             if(this.variableCount < this.variableFreeSlot) {
29                 this.variableCount = this.variableFreeSlot;
30             }
31             return thisSlot;
32         }
33
34         public void ReleaseVariableSlots(int n) {
35         // This code does optimisation of variable placement. Comented out for this version
36         //      Reuse of the variable disable the check that variable was assigned before the actual use
37         //      this check has to be done in compile time n future.
38 //            this.variableFreeSlot -= n;
39         }
40     }
41 }