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


C# VariableDeclaration类代码示例

本文整理汇总了C#中VariableDeclaration的典型用法代码示例。如果您正苦于以下问题:C# VariableDeclaration类的具体用法?C# VariableDeclaration怎么用?C# VariableDeclaration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ForExpression

 public ForExpression(Position pos, VariableDeclaration varDec, Expression high, Expression body)
 {
     Pos = pos;
     VarDec = varDec;
     High = high;
     Body = body;
 }
开发者ID:Nxun,项目名称:Naive-Tiger,代码行数:7,代码来源:AbstractSyntax.Expression.cs

示例2: VisitVariableDeclaration

		public override object VisitVariableDeclaration(VariableDeclaration variableDeclaration, object data)
		{
			if (nameComparer.Equals(from, variableDeclaration.Name)) {
				variableDeclaration.Name = to;
			}
			return base.VisitVariableDeclaration(variableDeclaration, data);
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:7,代码来源:RenameIdentifierVisitor.cs

示例3: LocalVariablesDeclaration

        public LocalVariablesDeclaration(Expression type, VariableDeclaration variables,
		                                  TokenPosition position)
            : base(position)
        {
            this.type = type;
            this.variables = variables;
        }
开发者ID:ronsaldo,项目名称:chela,代码行数:7,代码来源:LocalVariablesDeclaration.cs

示例4: visit

 public void visit(VariableDeclaration node)
 {
     if (symboltable.resolve(node.Name) != null)
         throw new SemanticError("Variable " + node.Name +
             " is already defined (row " + node.Row + ").");
     Symbol symbol = new Symbol(node.Name, node.Type);
     symboltable.define(symbol);
 }
开发者ID:Lateks,项目名称:Mini-PL-Interpreter,代码行数:8,代码来源:SemanticAnalysis.cs

示例5: Walk

 public override object Walk(VariableDeclaration node)
 {
     var value = node.Initializer == null
         ? null
         : node.Initializer.Accept(this);
     Context.CurrentFrame.Define(node.Identifier.Value, value);
     return value;
 }
开发者ID:buunguyen,项目名称:bike,代码行数:8,代码来源:Interpreter.cs

示例6: Walk

 public virtual object Walk(VariableDeclaration node)
 {
     if (Enter(node))
     {
         node.Identifier.Accept(this);
         if (node.Initializer != null)
             node.Initializer.Accept(this);
     }
     Exit(node);
     return null;
 }
开发者ID:buunguyen,项目名称:bike,代码行数:11,代码来源:NodeWalker.cs

示例7: InvalidRange

        public void InvalidRange()
        {
            var stringlit = new StringLiteral("foo", 0);
            var range = new Range(stringlit, stringlit, 0);
            var variabledecl = new VariableDeclaration("foo", "int", 0);
            var variable = new VariableReference("foo", 0);
            var loop = new Loop(variable, range, new List<Statement>(), 0);
            statementlist.Add(variabledecl);
            statementlist.Add(loop);
            var parsetree = new Program(statementlist);

            Assert.Throws<SemanticError>(() => symbolTableBuilder.BuildSymbolTableAndTypeCheck(parsetree));
        }
开发者ID:Lateks,项目名称:Mini-PL-Interpreter,代码行数:13,代码来源:SemanticAnalysisTest.cs

示例8: NonIntegerLoopVariable

        public void NonIntegerLoopVariable(string type)
        {
            var variabledecl = new VariableDeclaration("foo", type, 0);
            statementlist.Add(variabledecl);
            var variable = new VariableReference("foo", 0);
            var integer = new IntegerLiteral("5", 0);
            var range = new Range(integer, integer, 0);
            var variabledecl2 = new VariableDeclaration("bar", "int", 0);
            var loopbody = new List<Statement>();
            loopbody.Add(variabledecl2);
            var loop = new Loop(variable, range, loopbody, 0);
            statementlist.Add(loop);
            var parsetree = new Program(statementlist);

            Assert.Throws<SemanticError>(() => symbolTableBuilder.BuildSymbolTableAndTypeCheck(parsetree));
        }
开发者ID:Lateks,项目名称:Mini-PL-Interpreter,代码行数:16,代码来源:SemanticAnalysisTest.cs

示例9: FalseAnd

        public void FalseAnd()
        {
            var falseboolean = new LogicalOp("=", new IntegerLiteral("4", 0), new IntegerLiteral("5", 0), 0);
            var trueboolean = new LogicalOp("=", new IntegerLiteral("4", 0), new IntegerLiteral("5", 0), 0);
            var and1 = new LogicalOp("&", falseboolean, trueboolean, 0);
            var and2 = new LogicalOp("&", falseboolean, falseboolean, 0);
            var assignment1 = new Assignment(result, and1, 0);
            program.Add(assignment1);
            var result2 = new VariableDeclaration("result2", "bool", 0);
            symboltable.define(new Symbol("result2", "bool"));
            var assignment2 = new Assignment(result2, and2, 0);
            program.Add(assignment2);

            interpreter.Run(new Program(program));
            Assert.That(interpreter.Valuetable[symboltable.resolve("result")], Is.EqualTo(false));
            Assert.That(interpreter.Valuetable[symboltable.resolve("result2")], Is.EqualTo(false));
        }
开发者ID:Lateks,项目名称:Mini-PL-Interpreter,代码行数:17,代码来源:InterpretingNodeVisitorTest.cs

示例10: MatchesLocalVariable

        private static bool MatchesLocalVariable(SrcMLDataContext db, VariableDeclaration def, XElement use)
        {
            if (def.IsGlobal ?? false)
                return false;

            if (def.DeclarationName != use.Value)
                return false;
            
            var useXPath = use.GetXPath(false);
            var validScopes = from scope in db.ValidScopes
                              where scope.DefinitionId == def.Id
                              select scope;
            foreach (var scope in validScopes)
            {
                if (useXPath.StartsWith(scope.XPath))
                    return true;
            }

            var method = (from ancestor in use.Ancestors()
                          where ContainerNames.MethodDefinitions.Any(mn => mn == ancestor.Name)
                          select ancestor).FirstOrDefault();
            var classNameFromMethod = SrcMLHelper.GetClassNameForMethod(method);

            if (null == classNameFromMethod)
            {
                return false;
            }

            var classDef = from scope in def.ValidScopes.OfType<TypeDefinition>()
                           where scope.TypeName == classNameFromMethod.Value
                           select scope;
            if (classDef.Any())
            {
                return true;
            }

            return false;
        }
开发者ID:vinayaugustine,项目名称:SrcML.NET,代码行数:38,代码来源:DeclarationTester.cs

示例11: Exit

 public override void Exit(VariableDeclaration node)
 {
     level--;
 }
开发者ID:buunguyen,项目名称:bike,代码行数:4,代码来源:PrintNodeWalker.cs

示例12: Exit

 public virtual void Exit(VariableDeclaration node)
 {
 }
开发者ID:buunguyen,项目名称:bike,代码行数:3,代码来源:EnterForWalkerGenerator.cs

示例13: Enter

 public virtual bool Enter(VariableDeclaration node)
 {
     return true;
 }
开发者ID:buunguyen,项目名称:bike,代码行数:4,代码来源:EnterForWalkerGenerator.cs

示例14: Using

		public Using (Expression expr, Statement stmt, Location loc)
			: base (stmt, loc)
		{
			this.decl = new VariableDeclaration (expr);
		}
开发者ID:alisci01,项目名称:mono,代码行数:5,代码来源:statement.cs

示例15: VisitVariableDeclaration

    public virtual Differences VisitVariableDeclaration(VariableDeclaration variableDeclaration1, VariableDeclaration variableDeclaration2){
      Differences differences = new Differences(variableDeclaration1, variableDeclaration2);
      if (variableDeclaration1 == null || variableDeclaration2 == null){
        if (variableDeclaration1 != variableDeclaration2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++;
        return differences;
      }
      VariableDeclaration changes = (VariableDeclaration)variableDeclaration2.Clone();
      VariableDeclaration deletions = (VariableDeclaration)variableDeclaration2.Clone();
      VariableDeclaration insertions = (VariableDeclaration)variableDeclaration2.Clone();

      //      variableDeclaration1.Field;
      //      variableDeclaration1.Initializer;
      //      variableDeclaration1.Name;
      //      variableDeclaration1.Type;

      if (differences.NumberOfDifferences == 0){
        differences.Changes = null;
        differences.Deletions = null;
        differences.Insertions = null;
      }else{
        differences.Changes = changes;
        differences.Deletions = deletions;
        differences.Insertions = insertions;
      }
      return differences;
    }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:26,代码来源:Comparer.cs


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