Beispiel #1
0
 // Rename every non-parameter in given compilation environment and include new parameter in 
 // this compilation environment
 public void FreshenLocals(CompilationEnvironment inlinedCompEnv)
 {
     foreach (var kv in inlinedCompEnv.Variables)
     {
         if (kv.Value.ArgLocal == ArgLocal.Local)
         {
             var newid = NameSupply.GenSym();
             var cell = new VariableCell(newid);
             Bind(kv.Value.Id, cell.Read());
             CompEnv.AddVariable(newid, kv.Value.ArgLocal, kv.Value.IsInit, kv.Value.IsReadOnly, kv.Value.Type);
         }
     }
 }
Beispiel #2
0
        private IList<VariableCell> getVariableCells(WorksheetPart worksheetPart)
        {
            var result = new List<VariableCell>();

            var workbookPart = (WorkbookPart) worksheetPart.GetParentParts().FirstOrDefault();
            if (workbookPart == null)
                throw new ArgumentException("Unable to get the WorkbookPart for the provided WorksheetPart.");

            var sheetData = worksheetPart.Worksheet.GetFirstChild<SheetData>();
            var cells = sheetData.Descendants<Cell>();
            foreach (var cell in cells)
            {
                var cellValue = GetCellValueAsString(workbookPart, cell);
                var cellMatch = this.variableRegex.Match(cellValue);
                if (cellMatch.Success)
                {
                    var variable = cellMatch.Groups[1];
                    var subvariables = variable.Value.Split(variableSeparator);

                    if (subvariables.Length < 2)
                        continue;

                    var variableCell = new VariableCell
                    {
                        Cell = cell,
                        TableName = subvariables[0],
                        ColumnName = subvariables[1]
                    };
                    result.Add(variableCell);
                }
            }

            return result;
        }
Beispiel #3
0
 public JST.Identifier FreshenArgument(JST.Identifier id, TypeRef type)
 {
     var newid = NameSupply.GenSym();
     var cell = new VariableCell(newid);
     Bind(id, cell.Read());
     CompEnv.AddVariable(newid, ArgLocal.Local, true, true, type);
     return newid;
 }