本文整理汇总了C#中JsExpression.NotEqualTo方法的典型用法代码示例。如果您正苦于以下问题:C# JsExpression.NotEqualTo方法的具体用法?C# JsExpression.NotEqualTo怎么用?C# JsExpression.NotEqualTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsExpression
的用法示例。
在下文中一共展示了JsExpression.NotEqualTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MemberReference
public JsExpression MemberReference(JsExpression @this, ISymbol symbol, bool isSetter = false, bool isBaseReference = false)
{
switch (symbol.Kind)
{
case SymbolKind.Field:
{
var field = (IFieldSymbol)symbol;
var result = (JsExpression)@this.Member(field.GetMemberName());
if (field.Type is IArrayTypeSymbol && !field.IsExported())
{
result = MakeArray(result, (IArrayTypeSymbol)field.Type);
}
return result;
}
case SymbolKind.Event:
{
var field = (IEventSymbol)symbol;
return @this.Member(field.GetBackingFieldName());
}
case SymbolKind.Property:
{
var property = (IPropertySymbol)symbol;
if (property.ContainingType.IsGenericType && Equals(property.ContainingType.ConstructedFrom, Context.Instance.NullableType))
{
property = property.OriginalDefinition;
if (Equals(property, Context.Instance.NullableHasValue))
{
return @this.NotEqualTo(Js.Null()).Parenthetical();
}
else if (Equals(property, Context.Instance.NullableValue))
{
return Js.Reference(SpecialNames.NullableGetValue).Invoke(@this);
}
}
return GetPropertyValue(@this, property, isSetter, isBaseReference);
}
case SymbolKind.Parameter:
return transformer.ReferenceDeclarationInScope(symbol).GetReference();
case SymbolKind.NamedType:
var namedTypeSymbol = (INamedTypeSymbol)symbol;
var type = Type(namedTypeSymbol);
if (!(type is JsInvocationExpression) && namedTypeSymbol.IsExported())
type = type.Invoke();
return type;
case SymbolKind.Local:
var declaration = transformer.ReferenceDeclarationInScope(symbol);
return !isSetter ? declaration.GetReference() : declaration.SetReference();
case SymbolKind.Method:
{
var method = (IMethodSymbol)symbol;
var containingSymbol = symbol.ContainingType;
var name = method.GetMemberName();
var target = method.IsStatic ? Type(containingSymbol) : @this;
if (Equals(method.ContainingType, containingSymbol))
{
return target.Member(name);
}
else if (containingSymbol.IsSubclassOf(method.ContainingType))
{
return target.Member(name);
}
else
{
throw new Exception();
}
}
case SymbolKind.Namespace:
return Js.Reference(symbol.Name);
case SymbolKind.Label:
return Js.Reference(symbol.Name);
case SymbolKind.TypeParameter:
return Js.Reference(symbol.Name);
default:
throw new InvalidOperationException("Unexpected node: " + symbol);
}
}