本文整理汇总了C#中ICompilationUnit类的典型用法代码示例。如果您正苦于以下问题:C# ICompilationUnit类的具体用法?C# ICompilationUnit怎么用?C# ICompilationUnit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICompilationUnit类属于命名空间,在下文中一共展示了ICompilationUnit类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetResult
public GenerateNamespaceImport GetResult (ProjectDom dom, ICompilationUnit unit, IType type, TextEditorData data)
{
GenerateNamespaceImport result;
if (cache.TryGetValue (type.Namespace, out result))
return result;
result = new GenerateNamespaceImport ();
cache[type.Namespace] = result;
result.InsertNamespace = false;
DomLocation location = new DomLocation (data.Caret.Line, data.Caret.Column);
foreach (IUsing u in unit.Usings.Where (u => u.ValidRegion.Contains (location))) {
if (u.Namespaces.Any (ns => type.Namespace == ns)) {
result.GenerateUsing = false;
return result;
}
}
result.GenerateUsing = true;
string name = type.DecoratedFullName.Substring (type.Namespace.Length + 1);
foreach (IUsing u in unit.Usings.Where (u => u.ValidRegion.Contains (location))) {
foreach (string ns in u.Namespaces) {
if (dom.SearchType (unit, unit.GetTypeAt (location), unit.GetMemberAt (location), ns + "." + name) != null) {
result.GenerateUsing = false;
result.InsertNamespace = true;
return result;
}
}
}
return result;
}
开发者ID:pgoron,项目名称:monodevelop,代码行数:31,代码来源:ImportSymbolHandler.cs
示例2: AddImportedNamespaceContents
public static void AddImportedNamespaceContents(ArrayList result, ICompilationUnit cu, IClass callingClass)
{
IProjectContent projectContent = cu.ProjectContent;
projectContent.AddNamespaceContents(result, "", projectContent.Language, true);
foreach (IUsing u in cu.GetAllUsings()) {
AddUsing(result, u, projectContent);
}
AddUsing(result, projectContent.DefaultImports, projectContent);
if (callingClass != null) {
string[] namespaceParts = callingClass.Namespace.Split('.');
for (int i = 1; i <= namespaceParts.Length; i++) {
foreach (object member in projectContent.GetNamespaceContents(string.Join(".", namespaceParts, 0, i))) {
if (!result.Contains(member))
result.Add(member);
}
}
IClass currentClass = callingClass;
do {
foreach (IClass innerClass in currentClass.GetCompoundClass().GetAccessibleTypes(currentClass)) {
if (!result.Contains(innerClass))
result.Add(innerClass);
}
currentClass = currentClass.DeclaringType;
} while (currentClass != null);
}
}
开发者ID:modulexcite,项目名称:FluentSharp_Fork.SharpDevelopEditor,代码行数:27,代码来源:CtrlSpaceResolveHelper.cs
示例3: CreateMyApplication
static IClass CreateMyApplication(ICompilationUnit cu, VBNetProject project, string ns)
{
DefaultClass c = new DefaultClass(cu, ns + ".MyApplication");
c.ClassType = ClassType.Class;
c.Modifiers = ModifierEnum.Internal | ModifierEnum.Sealed | ModifierEnum.Partial | ModifierEnum.Synthetic;
c.Attributes.Add(new DefaultAttribute(CreateTypeRef(cu, "Microsoft.VisualBasic.HideModuleNameAttribute")));
switch (project.OutputType) {
case OutputType.WinExe:
c.BaseTypes.Add(CreateTypeRef(cu, "Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase"));
if (project.GetEvaluatedProperty("MyType") == "WindowsForms") {
c.Methods.Add(
new DefaultMethod(c, "Main") {
Modifiers = ModifierEnum.Internal | ModifierEnum.Static,
ReturnType = c.ProjectContent.SystemTypes.Void,
Parameters = new[] {
new DefaultParameter(
"args",
new ArrayReturnType(c.ProjectContent, c.ProjectContent.SystemTypes.String, 1),
DomRegion.Empty
)
}
});
}
break;
case OutputType.Exe:
c.BaseTypes.Add(CreateTypeRef(cu, "Microsoft.VisualBasic.ApplicationServices.ConsoleApplicationBase"));
break;
default:
c.BaseTypes.Add(CreateTypeRef(cu, "Microsoft.VisualBasic.ApplicationServices.ApplicationBase"));
break;
}
return c;
}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:33,代码来源:MyNamespaceBuilder.cs
示例4: JavaScriptRegionWalker
public JavaScriptRegionWalker(
JavaScriptAst ast,
ICompilationUnit compilationUnit)
{
this.ast = ast;
this.compilationUnit = compilationUnit;
}
开发者ID:fanyjie,项目名称:SharpDevelop,代码行数:7,代码来源:JavaScriptRegionWalker.cs
示例5: AddDefaultUsings
void AddDefaultUsings(ICompilationUnit compilationUnit)
{
AddUsing("System.Web.Mvc", compilationUnit);
AddUsing("System.Web.Mvc.Ajax", compilationUnit);
AddUsing("System.Web.Mvc.Html", compilationUnit);
AddUsing("System.Web.Routing", compilationUnit);
}
开发者ID:GMRyujin,项目名称:SharpDevelop,代码行数:7,代码来源:RazorCSharpResolver.cs
示例6: AddNames
void AddNames (ICompilationUnit unit, int caretLine, int caretColumn)
{
foreach (IType cls in unit.Types) {
if (cls.BodyRegion.Contains (caretLine, caretColumn)) {
// Enclosing namespace:
AddName (cls.Namespace, "");
enclosingNamespace = cls.Namespace;
// For inner classes:
AddName (cls.FullName, "");
}
}
foreach (IUsing u in unit.Usings) {
if (u != null) {
foreach (string us in u.Namespaces)
AddName (us, "");
}
}
// Namespace aliases
foreach (IUsing u in unit.Usings) {
if (u != null) {
foreach (KeyValuePair<string, IReturnType> e in u.Aliases)
AddName (e.Value.FullName, e.Key);
}
}
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:27,代码来源:TypeNameResolver.cs
示例7: ParseInformationEventArgs
public ParseInformationEventArgs(string fileName, IProjectContent projectContent, ICompilationUnit oldCompilationUnit, ICompilationUnit newCompilationUnit)
{
this.fileName = fileName;
this.projectContent = projectContent;
this.oldCompilationUnit = oldCompilationUnit;
this.newCompilationUnit = newCompilationUnit;
}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:7,代码来源:ParseInformationEventHandler.cs
示例8: RetrieveRegions
void RetrieveRegions(ICompilationUnit cu, ICSharpCode.NRefactory.Parser.SpecialTracker tracker)
{
for (int i = 0; i < tracker.CurrentSpecials.Count; ++i) {
ICSharpCode.NRefactory.PreprocessingDirective directive = tracker.CurrentSpecials[i] as ICSharpCode.NRefactory.PreprocessingDirective;
if (directive != null) {
if (directive.Cmd == "#region") {
int deep = 1;
for (int j = i + 1; j < tracker.CurrentSpecials.Count; ++j) {
ICSharpCode.NRefactory.PreprocessingDirective nextDirective = tracker.CurrentSpecials[j] as ICSharpCode.NRefactory.PreprocessingDirective;
if (nextDirective != null) {
switch (nextDirective.Cmd) {
case "#region":
++deep;
break;
case "#endregion":
--deep;
if (deep == 0) {
cu.FoldingRegions.Add(new FoldingRegion(directive.Arg.Trim(), new DomRegion(directive.StartPosition, nextDirective.EndPosition)));
goto end;
}
break;
}
}
}
end: ;
}
}
}
}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:29,代码来源:Parser.cs
示例9: GetModelTypeName
static string GetModelTypeName(ICompilationUnit compilationUnit)
{
var originalRazorCompilationUnit = compilationUnit as RazorCompilationUnit;
if (originalRazorCompilationUnit != null) {
return originalRazorCompilationUnit.ModelTypeName;
}
return String.Empty;
}
开发者ID:GMRyujin,项目名称:SharpDevelop,代码行数:8,代码来源:RazorCompilationUnit.cs
示例10: PythonClass
public PythonClass(ICompilationUnit compilationUnit, ClassDefinition classDefinition)
: base(compilationUnit, String.Empty)
{
GetFullyQualifiedName(classDefinition);
GetClassRegions(classDefinition);
AddBaseTypes(classDefinition.Bases);
compilationUnit.Classes.Add(this);
}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:9,代码来源:PythonClass.cs
示例11: ParseInformation
public ParseInformation(ICompilationUnit unit)
{
if (unit == null)
throw new ArgumentNullException("unit");
unit.Freeze();
// if (!unit.IsFrozen)
// throw new ArgumentException("unit must be frozen for use in ParseInformation");
this.unit = unit;
}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:9,代码来源:ParseInformation.cs
示例12: CompilationUnitHelper
public CompilationUnitHelper()
{
CompilationUnit = MockRepository.GenerateStub<ICompilationUnit>();
LanguageProperties language = MockRepository.GenerateStub<LanguageProperties>(StringComparer.InvariantCultureIgnoreCase);
language.Stub(lang => lang.CodeGenerator).Return(FakeCodeGenerator);
CompilationUnit.Stub(unit => unit.Language).Return(language);
CompilationUnit.Stub(unit => unit.Classes).Return(Classes);
CompilationUnit.Stub(unit => unit.UsingScope).Return(UsingScopeHelper.UsingScope);
}
开发者ID:rbrunhuber,项目名称:SharpDevelop,代码行数:9,代码来源:CompilationUnitHelper.cs
示例13: FindMatchingClass
IClass FindMatchingClass(ICompilationUnit unit)
{
foreach (IClass c in unit.Classes) {
if (c.FullyQualifiedName == Class.FullyQualifiedName) {
return c;
}
}
return null;
}
开发者ID:rbrunhuber,项目名称:SharpDevelop,代码行数:9,代码来源:ClassCodeGenerator.cs
示例14: GetCurrentClass
/// <summary>
/// Returns the class in which the carret currently is, returns null
/// if the carret is outside the class boundaries.
/// </summary>
IClass GetCurrentClass(TextEditorControl textEditorControl, ICompilationUnit cu, string fileName)
{
IDocument document = textEditorControl.Document;
if (cu != null) {
int caretLineNumber = document.GetLineNumberForOffset(textEditorControl.ActiveTextAreaControl.Caret.Offset) + 1;
int caretColumn = textEditorControl.ActiveTextAreaControl.Caret.Offset - document.GetLineSegment(caretLineNumber - 1).Offset + 1;
return FindClass(cu.Classes, caretLineNumber, caretColumn);
}
return null;
}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:14,代码来源:GenerateCodeCommand.cs
示例15: FilePosition
public FilePosition(ICompilationUnit compilationUnit, int line, int column)
{
this.position = new Location(column, line);
this.compilationUnit = compilationUnit;
if (compilationUnit != null) {
this.filename = compilationUnit.FileName;
} else {
this.filename = null;
}
}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:10,代码来源:FilePosition.cs
示例16: RefactoringMenuContext
public RefactoringMenuContext(ITextEditor editor, ExpressionResult expressionResult,
ResolveResult resolveResult, bool isDefinition,
IProjectContent projectContent, ICompilationUnit compilationUnit)
{
this.Editor = editor;
this.ExpressionResult = expressionResult;
this.ResolveResult = resolveResult;
this.IsDefinition = isDefinition;
this.ProjectContent = projectContent;
this.CompilationUnit = compilationUnit;
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:11,代码来源:RefactoringMenuBuilder.cs
示例17: ParseInformationEventArgs
public ParseInformationEventArgs(FileName fileName, IProjectContent projectContent, ICompilationUnit oldCompilationUnit, ParseInformation newParseInformation)
{
if (fileName == null)
throw new ArgumentNullException("fileName");
if (projectContent == null)
throw new ArgumentNullException("projectContent");
this.fileName = fileName;
this.projectContent = projectContent;
this.oldCompilationUnit = oldCompilationUnit;
this.newParseInformation = newParseInformation;
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:11,代码来源:ParseInformationEventArgs.cs
示例18: DefaultClass
public DefaultClass(ICompilationUnit compilationUnit, string fullyQualifiedName)
: base(null)
{
if (compilationUnit == null)
throw new ArgumentNullException("compilationUnit");
if (fullyQualifiedName == null)
throw new ArgumentNullException("fullyQualifiedName");
this.compilationUnit = compilationUnit;
this.FullyQualifiedName = fullyQualifiedName;
this.UsingScope = compilationUnit.UsingScope;
}
开发者ID:SergeTruth,项目名称:OxyChart,代码行数:11,代码来源:DefaultClass.cs
示例19: SetUpFixture
public void SetUpFixture()
{
string python = "class Test:\r\n" +
"\tdef foo(self):\r\n" +
"\t\tpass";
DefaultProjectContent projectContent = new DefaultProjectContent();
PythonParser parser = new PythonParser();
compilationUnit = parser.Parse(projectContent, @"C:\test.py", python);
if (compilationUnit.Classes.Count > 0) {
c = compilationUnit.Classes[0];
if (c.Methods.Count > 0) {
method = c.Methods[0];
}
TextArea textArea = new TextArea();
document = new TextDocument();
textArea.Document = document;
textArea.Document.Text = python;
ParserFoldingStrategy foldingStrategy = new ParserFoldingStrategy(textArea);
ParseInformation parseInfo = new ParseInformation(compilationUnit);
foldingStrategy.UpdateFoldings(parseInfo);
List<FoldingSection> folds = new List<FoldingSection>(foldingStrategy.FoldingManager.AllFoldings);
if (folds.Count > 0) {
classFold = folds[0];
}
if (folds.Count > 1) {
methodFold = folds[1];
}
}
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:34,代码来源:ParseClassWithMethodTestFixture.cs
示例20: ResolveVisitor
public ResolveVisitor(BooResolver resolver)
{
this.resolver = resolver;
this.callingClass = resolver.CallingClass;
this.projectContent = resolver.ProjectContent;
this.cu = resolver.CompilationUnit;
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:7,代码来源:ResolveVisitor.cs
注:本文中的ICompilationUnit类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论