本文整理汇总了C#中Scope.GetVarInstance方法的典型用法代码示例。如果您正苦于以下问题:C# Scope.GetVarInstance方法的具体用法?C# Scope.GetVarInstance怎么用?C# Scope.GetVarInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scope
的用法示例。
在下文中一共展示了Scope.GetVarInstance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckSemantics
public override void CheckSemantics(Scope scope, List<SemanticError> errors)
{
var varInfo = scope.GetVarInstance(Text);
if (varInfo == null)
errors.Add(SemanticError.UndefinedVariableUsed(Text, this));
else
{
ExpressionType = scope.GetType(varInfo.VariableType);
VariableILName = scope.GetILVarNames(Text);
ILName = VariableILName;
}
}
示例2: CheckSemantics
public override void CheckSemantics(Scope scope, List<SemanticError> errors)
{
var varInfo = scope.GetVarInstance(Record.Text);
//Verify if the variable exist
if (varInfo == null)
{
errors.Add(SemanticError.UndefinedVariableUsed(this.Record.Text, this));
return;
}
NextNested.CheckSemantics(varInfo.VariableType, scope, errors);
ExpressionType = NextNested.ExpressionType;
Record.ILName = scope.GetILVarNames(Record.Text);
ILName = scope.GetILVarNames(Record.Text);
ExpressionType.ILName = scope.GetILTypeName(ExpressionType.Name);
}
示例3: CheckSemantics
public override void CheckSemantics(Scope scope, List<SemanticError> errors)
{
//check the existence and the semantic of the left value.
Identifier.CheckSemantics(scope, errors);
//check the semantick of the expression.
this.Expr.CheckSemantics(scope, errors);
if (Identifier is IdNode)
if (scope.ContainsVarInstance(Identifier.Text) && scope.GetVarInstance(Identifier.Text).ReadOnly)
errors.Add(SemanticError.ReadOnlyAssing(Identifier.Text,this));
if (Expr.ExpressionType.Type == TypesEnumeration.Nil)
{
if (!scope.GetType(Identifier.ExpressionType.Name).Nilable)
errors.Add(SemanticError.InvalidNilAssignation(Identifier.ExpressionType.Name, this));
}
else if (Expr.ExpressionType.Type == TypesEnumeration.Void || scope.GetType(Identifier.ExpressionType.Name).Name != scope.GetType(Expr.ExpressionType.Name).Name)
errors.Add(SemanticError.WrongType(Identifier.ExpressionType.Name, Expr.ExpressionType.Name, this));
}
示例4: CheckSemantics
public override void CheckSemantics(Scope scope, List<SemanticError> errors)
{
//Verify if the array exist
var varInfo = scope.GetVarInstance(this.ArrayIdentifier.Text);
if (varInfo == null)
{
errors.Add(SemanticError.UndefinedVariableUsed(this.ArrayIdentifier.Text, this));
return;
}
this.NextNested.CheckSemantics(varInfo.VariableType, scope, errors);
ExpressionType = this.NextNested.ExpressionType;
ArrayIdentifier.ILName = scope.GetILVarNames(ArrayIdentifier.Text);
var arrayInfo = (ArrayInfo) scope.GetType(varInfo.VariableType);
NextNested.Index.ILName = scope.GetILTypeName(arrayInfo.ItemsType);
ILName = scope.GetILVarNames(ArrayIdentifier.Text);
ExpressionType.ILName = scope.GetILTypeName(ExpressionType.Name);
}