public void AddFunction(Function function) { // Store the function. functions.Add(function); // Register the local scopes. for (int i = 0; i < function.GetLexicalScopeCount(); ++i) { LexicalScope scope = function.GetLexicalScope(i); // Register the position filename. TokenPosition pos = scope.Position; if (pos == null) { pos = NullPosition; } AddFileName(pos.GetFileName()); } // Register the variables names and positions. foreach (LocalVariable local in function.GetLocals()) { // Register the local name. AddString(local.GetName()); // Register the position filename TokenPosition localPos = local.Position; if (localPos == null) { localPos = NullPosition; } AddFileName(localPos.GetFileName()); } // Register the filenames. string lastFilename = null; foreach (BasicBlock bb in function.GetBasicBlocks()) { foreach (Instruction instruction in bb.GetInstructions()) { // Ignore instructions without position. TokenPosition position = instruction.GetPosition(); if (position == null) { position = NullPosition; } // Set the filename. string filename = position.GetFileName(); if (position != null && lastFilename != filename) { AddFileName(filename); lastFilename = filename; } } } }
public void AddStructure(Structure structure) { // Store the structure. structures.Add(structure); // Register the position filename. TokenPosition pos = structure.Position; if (pos == null) { pos = NullPosition; } AddFileName(pos.GetFileName()); }
public void AddField(FieldVariable field) { // Store the field. fields.Add(field); // Register the position filename. TokenPosition pos = field.Position; if (pos == null) { pos = NullPosition; } AddFileName(pos.GetFileName()); }
private void EmitPosition(ModuleWriter writer, TokenPosition position) { // Use the null position if unknown. if (position == null) { position = NullPosition; } // Emit the filename, line and column. uint filename = AddFileName(position.GetFileName()); int line = position.GetLine(); int column = position.GetColumn(); writer.Write(filename); writer.Write(line); writer.Write(column); }
private void EmitPosition(ModuleWriter writer, TokenPosition position) { // Use the null position if unknown. if(position == null) position = NullPosition; // Emit the filename, line and column. uint filename = AddFileName(position.GetFileName()); int line = position.GetLine(); int column = position.GetColumn(); writer.Write(filename); writer.Write(line); writer.Write(column); }