当前位置: 首页>>代码示例>>C#>>正文


C# Modifiers.GetDeclarationLocation方法代码示例

本文整理汇总了C#中Modifiers.GetDeclarationLocation方法的典型用法代码示例。如果您正苦于以下问题:C# Modifiers.GetDeclarationLocation方法的具体用法?C# Modifiers.GetDeclarationLocation怎么用?C# Modifiers.GetDeclarationLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Modifiers的用法示例。


在下文中一共展示了Modifiers.GetDeclarationLocation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TypeDecl

 private void TypeDecl(Modifiers m, List<ICSharpCode.NRefactory.Parser.AST.AttributeSection> attributes)
 {
     List<TypeReference> list;
     List<TemplateDefinition> templates;
     List<ParameterDeclarationExpression> parameter = new List<ParameterDeclarationExpression>();
     if (this.la.kind == 0x3a)
     {
         m.Check(Modifier.Classes);
         base.lexer.NextToken();
         TypeDeclaration childNode = new TypeDeclaration(m.Modifier, attributes);
         templates = childNode.Templates;
         base.compilationUnit.AddChild(childNode);
         base.compilationUnit.BlockStart(childNode);
         childNode.StartLocation = m.GetDeclarationLocation(this.t.Location);
         childNode.Type = ICSharpCode.NRefactory.Parser.AST.ClassType.Class;
         base.Expect(1);
         childNode.Name = this.t.val;
         if (this.la.kind == 0x17)
         {
             this.TypeParameterList(templates);
         }
         if (this.la.kind == 9)
         {
             this.ClassBase(out list);
             childNode.BaseTypes = list;
         }
         while (this.IdentIsWhere())
         {
             this.TypeParameterConstraintsClause(templates);
         }
         this.ClassBody();
         if (this.la.kind == 11)
         {
             base.lexer.NextToken();
         }
         childNode.EndLocation = this.t.Location;
         base.compilationUnit.BlockEnd();
     }
     else if (this.StartOf(8))
     {
         m.Check(Modifier.StructsInterfacesEnumsDelegates);
         if (this.la.kind == 0x6c)
         {
             base.lexer.NextToken();
             TypeDeclaration declaration2 = new TypeDeclaration(m.Modifier, attributes);
             templates = declaration2.Templates;
             declaration2.StartLocation = m.GetDeclarationLocation(this.t.Location);
             base.compilationUnit.AddChild(declaration2);
             base.compilationUnit.BlockStart(declaration2);
             declaration2.Type = ICSharpCode.NRefactory.Parser.AST.ClassType.Struct;
             base.Expect(1);
             declaration2.Name = this.t.val;
             if (this.la.kind == 0x17)
             {
                 this.TypeParameterList(templates);
             }
             if (this.la.kind == 9)
             {
                 this.StructInterfaces(out list);
                 declaration2.BaseTypes = list;
             }
             while (this.IdentIsWhere())
             {
                 this.TypeParameterConstraintsClause(templates);
             }
             this.StructBody();
             if (this.la.kind == 11)
             {
                 base.lexer.NextToken();
             }
             declaration2.EndLocation = this.t.Location;
             base.compilationUnit.BlockEnd();
         }
         else if (this.la.kind == 0x52)
         {
             base.lexer.NextToken();
             TypeDeclaration declaration3 = new TypeDeclaration(m.Modifier, attributes);
             templates = declaration3.Templates;
             base.compilationUnit.AddChild(declaration3);
             base.compilationUnit.BlockStart(declaration3);
             declaration3.StartLocation = m.GetDeclarationLocation(this.t.Location);
             declaration3.Type = ICSharpCode.NRefactory.Parser.AST.ClassType.Interface;
             base.Expect(1);
             declaration3.Name = this.t.val;
             if (this.la.kind == 0x17)
             {
                 this.TypeParameterList(templates);
             }
             if (this.la.kind == 9)
             {
                 this.InterfaceBase(out list);
                 declaration3.BaseTypes = list;
             }
             while (this.IdentIsWhere())
             {
                 this.TypeParameterConstraintsClause(templates);
             }
             this.InterfaceBody();
             if (this.la.kind == 11)
             {
//.........这里部分代码省略.........
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:101,代码来源:Parser.cs

示例2: ClassMemberDecl

 private void ClassMemberDecl(Modifiers m, List<ICSharpCode.NRefactory.Parser.AST.AttributeSection> attributes)
 {
     ICSharpCode.NRefactory.Parser.AST.Statement stmt = null;
     if (this.StartOf(0x10))
     {
         this.StructMemberDecl(m, attributes);
     }
     else if (this.la.kind == 0x1b)
     {
         m.Check(Modifier.Destructors);
         Point location = this.t.Location;
         base.lexer.NextToken();
         base.Expect(1);
         DestructorDeclaration childNode = new DestructorDeclaration(this.t.val, m.Modifier, attributes);
         childNode.Modifier = m.Modifier;
         childNode.StartLocation = m.GetDeclarationLocation(location);
         base.Expect(20);
         base.Expect(0x15);
         childNode.EndLocation = this.t.EndLocation;
         if (this.la.kind == 0x10)
         {
             this.Block(out stmt);
         }
         else if (this.la.kind == 11)
         {
             base.lexer.NextToken();
         }
         else
         {
             base.SynErr(0x8a);
         }
         childNode.Body = (BlockStatement) stmt;
         base.compilationUnit.AddChild(childNode);
     }
     else
     {
         base.SynErr(0x8b);
     }
 }
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:39,代码来源:Parser.cs

示例3: StructMemberDecl

 private void StructMemberDecl(Modifiers m, List<ICSharpCode.NRefactory.Parser.AST.AttributeSection> attributes)
 {
     string name = null;
     TypeReference reference;
     List<ParameterDeclarationExpression> parameter = new List<ParameterDeclarationExpression>();
     ICSharpCode.NRefactory.Parser.AST.Statement stmt = null;
     List<VariableDeclaration> fieldDeclaration = new List<VariableDeclaration>();
     List<TemplateDefinition> templates = new List<TemplateDefinition>();
     TypeReference typeRef = null;
     if (this.la.kind == 0x3b)
     {
         Expression expression;
         m.Check(Modifier.VBInterfacs);
         base.lexer.NextToken();
         Point location = this.t.Location;
         this.Type(out reference);
         base.Expect(1);
         FieldDeclaration childNode = new FieldDeclaration(attributes, reference, m.Modifier | Modifier.Const);
         childNode.StartLocation = m.GetDeclarationLocation(location);
         VariableDeclaration item = new VariableDeclaration(this.t.val);
         childNode.Fields.Add(item);
         base.Expect(3);
         this.Expr(out expression);
         item.Initializer = expression;
         while (this.la.kind == 14)
         {
             base.lexer.NextToken();
             base.Expect(1);
             item = new VariableDeclaration(this.t.val);
             childNode.Fields.Add(item);
             base.Expect(3);
             this.Expr(out expression);
             item.Initializer = expression;
         }
         base.Expect(11);
         childNode.EndLocation = this.t.EndLocation;
         base.compilationUnit.AddChild(childNode);
     }
     else if (this.NotVoidPointer())
     {
         m.Check(Modifier.PropertysEventsMethods);
         base.Expect(0x7a);
         Point keywordLocation = this.t.Location;
         if (this.IsExplicitInterfaceImplementation())
         {
             this.TypeName(out typeRef, false);
             if ((this.la.kind != 15) || (this.Peek(1).kind != 110))
             {
                 name = TypeReference.StripLastIdentifierFromType(ref typeRef);
             }
         }
         else if (this.la.kind == 1)
         {
             base.lexer.NextToken();
             name = this.t.val;
         }
         else
         {
             base.SynErr(140);
         }
         if (this.la.kind == 0x17)
         {
             this.TypeParameterList(templates);
         }
         base.Expect(20);
         if (this.StartOf(10))
         {
             this.FormalParameterList(parameter);
         }
         base.Expect(0x15);
         MethodDeclaration declaration3 = new MethodDeclaration(name, m.Modifier, new TypeReference("void"), parameter, attributes);
         declaration3.StartLocation = m.GetDeclarationLocation(keywordLocation);
         declaration3.EndLocation = this.t.EndLocation;
         declaration3.Templates = templates;
         if (typeRef != null)
         {
             declaration3.InterfaceImplementations.Add(new InterfaceImplementation(typeRef, name));
         }
         base.compilationUnit.AddChild(declaration3);
         base.compilationUnit.BlockStart(declaration3);
         while (this.IdentIsWhere())
         {
             this.TypeParameterConstraintsClause(templates);
         }
         if (this.la.kind == 0x10)
         {
             this.Block(out stmt);
         }
         else if (this.la.kind == 11)
         {
             base.lexer.NextToken();
         }
         else
         {
             base.SynErr(0x8d);
         }
         base.compilationUnit.BlockEnd();
         declaration3.Body = (BlockStatement) stmt;
     }
     else if (this.la.kind == 0x44)
//.........这里部分代码省略.........
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:101,代码来源:Parser.cs


注:本文中的Modifiers.GetDeclarationLocation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。