public ExpressionVisitor(IMetadataHost host, CommonSemanticModel semanticModel, ReferenceMapper mapper, IMethodDefinition method) { this.host = host; this.semanticModel = semanticModel; this.mapper = mapper; this.method = method; this.parameters.Add(method, new List <IParameterDefinition>(method.Parameters)); this.tree = semanticModel.SyntaxTree; }
public StatementVisitor(IMetadataHost host, CommonSemanticModel semanticModel, ReferenceMapper mapper, IMethodDefinition method, ExpressionVisitor expressionVisitor) { this.host = host; this.semanticModel = semanticModel; this.mapper = mapper; this.method = method; this.tree = semanticModel.SyntaxTree as SyntaxTree; this.expressionVisitor = expressionVisitor; }
/// <summary> /// Translates the metadata "backbone" of the Roslyn assembly, creating a CCI /// assembly that is held onto by the returned reference mapper. The mapper /// can be used during a traversal of any syntax tree whose semantic model /// corresponds to the <paramref name="assemblySymbol"/>. The mapper will /// return the equivalent CCI node that corresponds to the semantic node it /// is given. /// </summary> public static ReferenceMapper TranslateAssembly(IMetadataHost host, IAssemblySymbol assemblySymbol) { Contract.Requires(host != null); Contract.Requires(assemblySymbol != null); Contract.Ensures(Contract.Result <ReferenceMapper>() != null); var rm = new ReferenceMapper(host, assemblySymbol); rm.TranslateMetadata(assemblySymbol); return(rm); }
public NodeVisitor(IMetadataHost host, CommonSemanticModel semanticModel, ISourceLocationProvider /*?*/ sourceLocationProvider) { this.host = host; this.nameTable = host.NameTable; this.semanticModel = semanticModel; this.sourceLocationProvider = sourceLocationProvider; this.contractMethods = new ContractMethods(host); // translate the entire metadata model for the assembly // the actual visit is just to get method bodies for any methods // defined in the cone that is visited. this.mapper = ReferenceMapper.TranslateAssembly(host, semanticModel.Compilation.Assembly); }
/// <summary> /// Translates the metadata "backbone" of the Roslyn assembly, creating a CCI /// assembly that is held onto by the returned reference mapper. The mapper /// can be used during a traversal of any syntax tree whose semantic model /// corresponds to the <paramref name="assemblySymbol"/>. The mapper will /// return the equivalent CCI node that corresponds to the semantic node it /// is given. /// </summary> public static ReferenceMapper TranslateAssembly(IMetadataHost host, R.IAssemblySymbol assemblySymbol) { Contract.Requires(host != null); Contract.Requires(assemblySymbol != null); Contract.Ensures(Contract.Result<ReferenceMapper>() != null); var rm = new ReferenceMapper(host, assemblySymbol); rm.TranslateMetadata(assemblySymbol); return rm; }