public CodeType(CodeModelContext context, ITypeDefinition typeDefinition, params IType[] typeArguments) : base(context, typeDefinition) { this.typeDefinition = typeDefinition; this.typeArguments = typeArguments; this.InfoLocation = GetInfoLocation(); }
public CodeNamespace(CodeModelContext context, INamespace ns) : base(context) { this.ns = ns; this.InfoLocation = global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationExternal; this.Language = context.CurrentProject.GetCodeModelLanguage(); }
FileCodeModelCodeNamespace(CodeModelContext context, NamespaceName namespaceName) { this.context = context; this.namespaceName = namespaceName; this.InfoLocation = global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationExternal; this.Language = context.CurrentProject.GetCodeModelLanguage(); }
public CodeElement(CodeModelContext context, ISymbolModel symbolModel) { this.context = context; this.symbolModel = symbolModel; if (symbolModel.ParentProject != null) this.Language = symbolModel.ParentProject.GetCodeModelLanguage(); }
internal static CodeType Create(CodeModelContext context, IType type) { ITypeDefinition typeDefinition = type.GetDefinition(); if (typeDefinition != null) { return Create(context.WithFilteredFileName(null), typeDefinition, type.TypeArguments.ToArray()); } return null; }
public FileCodeModel2(CodeModelContext context, Project project) { if (context == null || context.FilteredFileName == null) { throw new ArgumentException("context must be restricted to a file"); } this.context = context; this.project = project; }
public static CodeType Create(CodeModelContext context, IType type) { var typeDef = type.GetDefinition(); if (typeDef != null) { var typeModel = typeDef.GetModel(); if (typeModel != null) return Create(context.WithFilteredFileName(null), typeModel); } return null; }
internal static CodeType Create(CodeModelContext context, IType type) { ITypeDefinition typeDefinition = type.GetDefinition(); if (typeDefinition != null) { return(Create(context.WithFilteredFileName(null), typeDefinition, type.TypeArguments.ToArray())); } return(null); }
public override void SetUp() { base.SetUp(); project.Stub(p => p.Language).Return(null).WhenCalled(mi => mi.ReturnValue = projectLanguage); codeGenerator = MockRepository.GenerateStrictMock<CodeGenerator>(); codeModelContext = new CodeModelContext { CodeGenerator = codeGenerator, CurrentProject = project }; }
public override void SetUp() { base.SetUp(); project.Stub(p => p.Language).Return(null).WhenCalled(mi => mi.ReturnValue = projectLanguage); codeGenerator = MockRepository.GenerateMock<CodeGenerator>(); languageBinding = MockRepository.GenerateMock<ILanguageBinding>(); languageBinding.Stub(binding => binding.CodeGenerator).Return(codeGenerator); project.Stub(p => p.LanguageBinding).Return(languageBinding); codeModelContext = new CodeModelContext { CurrentProject = project }; }
public Project( MSBuildBasedProject project, IPackageManagementProjectService projectService, IPackageManagementFileService fileService) { this.MSBuildProject = project; this.projectService = projectService; this.fileService = fileService; context = new CodeModelContext { CurrentProject = project, DteProject = this }; CreateProperties(); Object = new ProjectObject(this); ProjectItems = new ProjectItems(this, this); }
internal static CodeType Create( CodeModelContext context, ITypeDefinition typeDefinition, params IType[] typeArguments) { switch (typeDefinition.Kind) { case TypeKind.Class: return new CodeClass2(context, typeDefinition); case TypeKind.Interface: return new CodeInterface(context, typeDefinition, typeArguments); case TypeKind.Module: case TypeKind.Struct: case TypeKind.Void: case TypeKind.Delegate: case TypeKind.Enum: default: return new CodeType(context, typeDefinition, typeArguments); } }
public static CodeType Create(CodeModelContext context, ITypeDefinitionModel typeModel) { switch (typeModel.TypeKind) { case TypeKind.Class: case TypeKind.Module: goto default; case TypeKind.Interface: goto default; case TypeKind.Struct: case TypeKind.Void: goto default; case TypeKind.Delegate: goto default; case TypeKind.Enum: goto default; default: return new CodeType(context, typeModel); } }
public static CodeElement CreateMember(CodeModelContext context, IMemberModel m) { switch (m.SymbolKind) { case SymbolKind.Field: return new CodeVariable(context, (IFieldModel)m); case SymbolKind.Property: case SymbolKind.Indexer: // return new CodeProperty2(m); throw new NotImplementedException(); case SymbolKind.Event: return null; // events are not supported in EnvDTE? case SymbolKind.Method: case SymbolKind.Operator: case SymbolKind.Constructor: case SymbolKind.Destructor: return new CodeFunction2(context, (IMethodModel)m); default: throw new NotSupportedException("Invalid value for SymbolKind"); } }
public FileCodeModel2(CodeModelContext context) { if (context == null || context.FilteredFileName == null) throw new ArgumentException("context must be restricted to a file"); this.context = context; var compilation = SD.ParserService.GetCompilation(context.CurrentProject); var projectContent = compilation.MainAssembly.UnresolvedAssembly as IProjectContent; if (projectContent != null) { IUnresolvedFile file = projectContent.GetFile(context.FilteredFileName); if (file != null) { var csharpFile = file as CSharpUnresolvedFile; if (csharpFile != null) AddUsings(codeElements, csharpFile.RootUsingScope, compilation); var resolveContext = new SimpleTypeResolveContext(compilation.MainAssembly); AddTypes(file.TopLevelTypeDefinitions .Select(td => td.Resolve(resolveContext) as ITypeDefinition) .Where(td => td != null).Distinct()); } } }
internal static CodeType Create( CodeModelContext context, ITypeDefinition typeDefinition, params IType[] typeArguments) { switch (typeDefinition.Kind) { case TypeKind.Class: return(new CodeClass2(context, typeDefinition)); case TypeKind.Interface: return(new CodeInterface(context, typeDefinition, typeArguments)); case TypeKind.Module: case TypeKind.Struct: case TypeKind.Void: case TypeKind.Delegate: case TypeKind.Enum: default: return(new CodeType(context, typeDefinition, typeArguments)); } }
internal static CodeElement CreateMember(CodeModelContext context, IMember member) { switch (member.SymbolKind) { case SymbolKind.Field: return(new CodeVariable(context, (IField)member)); case SymbolKind.Property: case SymbolKind.Indexer: return(new CodeProperty2(context, (IProperty)member)); case SymbolKind.Event: return(null); case SymbolKind.Method: case SymbolKind.Operator: case SymbolKind.Constructor: case SymbolKind.Destructor: return(new CodeFunction2(context, (IMethod)member)); default: throw new NotSupportedException("Invalid value for SymbolKind"); } }
public CodeClass2(CodeModelContext context, ITypeDefinition typeDefinition) : base(context, typeDefinition) { }
public CodeDelegate(CodeModelContext context, ITypeDefinition typeDefinition) : base(context, typeDefinition) { }
public CodeParameter2(CodeModelContext context, IParameter parameter) : base(context, parameter) { }
public CodeProperty2(CodeModelContext context, IProperty property) : base(context, property) { }
public CodeAttribute2(CodeModelContext context, IAttribute attribute) : base(context, attribute) { }
public FileCodeModelCodeNamespace(CodeModelContext context, string namespaceName) : this(context, new NamespaceName(namespaceName)) { }
public CodeVariable(CodeModelContext context, IField field) : base(context, field) { this.field = field; }
public CodeInterface(CodeModelContext context, ITypeDefinition typeDefinition, params IType[] typeArguments) : base(context, typeDefinition, typeArguments) { }
public CodeElement(CodeModelContext context, IEntity entity) { this.context = context; this.entity = entity; this.Language = context.CurrentProject.GetCodeModelLanguage(); }
public CodeElement(CodeModelContext context) { this.context = context; }
public CodeFunction2(CodeModelContext context, IMethod method) : base(context, method) { }
public CodeProperty(CodeModelContext context, IProperty property) : base(context, property) { this.property = property; }
public CodeStruct(CodeModelContext context, ITypeDefinition typeDefinition) : base(context, typeDefinition) { }
public CodeClass(CodeModelContext context, ITypeDefinition typeDefinition) : base(context, typeDefinition, typeDefinition.TypeArguments.ToArray()) { }
public CodeTypeRef2(CodeModelContext context, CodeElement parent, IType type) : base(context, parent, type) { }
internal static TextPoint CreateStartPoint(CodeModelContext context, DomRegion region) { return new TextPoint(region.FileName, region.Begin, context.DocumentLoader); }
public CodeModel(CodeModelContext context, Project project) { this.context = context; this.project = project; }
public CodeParameter(CodeModelContext context, IParameter parameter) : base(context) { this.parameter = parameter; }
public CodeElementsInNamespace(CodeModelContext context, INamespace ns) { this.context = context; this.ns = ns; GetCodeElements(); }
public CodeTypeRef(CodeModelContext context, CodeElement parent, IType type) { this.context = context; this.parent = parent; this.type = type; }
public CodeFunction2(CodeModelContext context, IMethodModel methodModel) : base(context, methodModel) { }
public CodeFunction(CodeModelContext context, IMethod method) : base(context, method) { this.method = method; }
public CodeAttribute(CodeModelContext context, IAttribute attribute) : base(context) { this.attribute = attribute; }
/// <summary> /// Note that projectContent may be different to the IClass.ProjectContent since the class /// is retrieved from the namespace contents and could belong to a separate project or /// referenced assembly. /// </summary> public CodeType(CodeModelContext context, ITypeDefinitionModel typeModel) : base(context, typeModel) { this.typeModel = typeModel; }
public CodeElementsInNamespace(CodeModelContext context) : this(context, context.DteProject.GetCompilationUnit().RootNamespace) { }
internal static CodeElement CreateMember(CodeModelContext context, IMember member) { switch (member.SymbolKind) { case SymbolKind.Field: return new CodeVariable(context, (IField)member); case SymbolKind.Property: case SymbolKind.Indexer: return new CodeProperty2(context, (IProperty)member); case SymbolKind.Event: return null; case SymbolKind.Method: case SymbolKind.Operator: case SymbolKind.Constructor: case SymbolKind.Destructor: return new CodeFunction2(context, (IMethod)member); default: throw new NotSupportedException("Invalid value for SymbolKind"); } }
public CodeClass(CodeModelContext context, ITypeDefinitionModel typeModel) : base(context, typeModel) { }