write(ILFile ilfile, int level, bool isNetStandard) { // ilfile.writeLine( 0, "// " + GetType().Name ); foreach (string line in m_lines) { var outputLine = line; // even if the dll is a netstandard dll we analyze it // using the .NET Fx, which has dependencies into the mscorlib. if (isNetStandard) { outputLine = line.Replace("[mscorlib]", "[netstandard]"); } ilfile.writeLine(level, outputLine); } if (null == m_elements) { return; } ilfile.writeLine(level, "{"); writeSubElements(ilfile, level + 1, isNetStandard); ilfile.writeLine(level, "}"); }
parse(ILFile ilfile) { string nextLine = ilfile.popLine(); if (null == nextLine) { return; } if (nextLine.StartsWith(".")) { ilfile.pushLine(nextLine); } else if (nextLine.StartsWith("IL_")) { ilfile.pushLine(nextLine); } else if (nextLine.StartsWith("{")) { parseSubElements(ilfile); } else if (nextLine.StartsWith("}")) { ilfile.pushLine(nextLine); } else if (nextLine.StartsWith("//")) { parse(ilfile); } else { m_lines.Add(nextLine); parse(ilfile); } }
public ILElementType(string keyWord, Type type) { m_keyWord = keyWord; m_type = type; ILFile.addElementType(this); }
writeSubElements(ILFile ilfile, int level, bool isNetStandard) { if (null == m_elements) { return; } foreach (ILElement element in m_elements) { element.write(ilfile, level, isNetStandard); } }
parse(ILFile ilfile) { string[] words = dropEmptyWords(getLine(0).Split(new char[] { '\t', ' ' })); if (2 < words.Length && isMultilineStatement(words[1])) { string line = getLine(0); while (-1 == line.IndexOf(')')) { line = ilfile.popLine(); addLine(line); } return; } base.parse(ilfile); }
parseSubElements(ILFile ilfile) { m_elements = new ArrayList(); for (string line = ilfile.popLine(); null != line; line = ilfile.popLine()) { if (line.StartsWith("}")) { return; } ILElement element = getElement(line); if (null != element) { m_elements.Add(element); element.parse(ilfile); } } }