本文整理汇总了C#中ISemanticResolver.EnsureAssignable方法的典型用法代码示例。如果您正苦于以下问题:C# ISemanticResolver.EnsureAssignable方法的具体用法?C# ISemanticResolver.EnsureAssignable怎么用?C# ISemanticResolver.EnsureAssignable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISemanticResolver
的用法示例。
在下文中一共展示了ISemanticResolver.EnsureAssignable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResolveExpAsRight
// Semantic resolution
// "a X= b" is semantically equivalent to "a = a X b"
protected override Exp ResolveExpAsRight(ISemanticResolver s)
{
// Note that the left side ("a") of "a X= b" is both a
// Left & Right side value
ResolveExpAsLeft(ref this.m_eLeft, s);
ResolveExpAsRight(ref this.m_expRight, s);
CalcCLRType(s);
// Ensure type match
s.EnsureAssignable(m_expRight, Left.CLRType);
return this;
}
示例2: ResolveStatement
// Semantic resolution
public override void ResolveStatement(ISemanticResolver s)
{
Exp.ResolveExpAsRight(ref this.m_expTest, s);
m_loopcount++;
BodyStmt.ResolveStatement(s);
m_loopcount--;
//s.EnsureDerivedType(s.ResolveCLRTypeToBlueType(typeof(bool)), TestExp);
s.EnsureAssignable(TestExp, typeof(bool));
}
示例3: ResolveHandler
public void ResolveHandler(ISemanticResolver s)
{
// Catch blocks can declare an identifier
if (IdVarName != null)
{
m_var = new LocalVarDecl(IdVarName, m_type);
Body.InjectLocalVar(m_var);
}
this.m_type.ResolveType(s);
Body.ResolveStatement(s);
// Catch type must be of type System.Exception
if (m_var != null)
{
s.EnsureAssignable(m_var.Symbol.m_type.CLRType, typeof(System.Exception), IdVarName.Location);
}
// Catch type must be of type System.Exception
//TypeEntry tSystem_Exception =s.ResolveCLRTypeToBlueType(typeof(System.Exception));
//s.EnsureDerivedType(tSystem_Exception, m_type.TypeRec, new FileRange());
}
示例4: Resolve
// Resolve this array initializer list.
// Provide with the type that we expect each element in the list to be
public void Resolve(ISemanticResolver s, TypeEntry tExpected)
{
// Each node must either be an expression or a nested array initializer list
//foreach(Node n in List)
for(int i = 0; i < m_list.Length; i++)
{
Node n = m_list[i];
if (n is Exp)
{
Exp e = (Exp) n;
Exp.ResolveExpAsRight(ref e, s);
m_list[i] = e;
s.EnsureAssignable(e, tExpected.CLRType);
}
else if (n is ArrayInitializer)
{
Debug.Assert(tExpected.IsArray); // @todo -legit
ArrayInitializer a = (ArrayInitializer) n;
TypeEntry tNested = tExpected.AsArrayType.ElemType;
a.Resolve(s, tNested);
}
else
{
// Error
Debug.Assert(false); // @todo - legit
}
}
}