本文整理汇总了C#中VariableName类的典型用法代码示例。如果您正苦于以下问题:C# VariableName类的具体用法?C# VariableName怎么用?C# VariableName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VariableName类属于命名空间,在下文中一共展示了VariableName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GotoStmt
public GotoStmt(Text.Span span, string/*!*/labelName, Text.Span nameSpan)
: base(span)
{
Debug.Assert(!string.IsNullOrEmpty(labelName));
_labelName = new VariableName(labelName);
_nameSpan = nameSpan;
}
示例2: Parse
public override bool Parse(IItemFactory itemFactory, ITextProvider text, ITokenStream stream)
{
var name = new VariableName(SassClassifierType.VariableReference);
if (name.Parse(itemFactory, text, stream))
{
Name = name;
Children.Add(name);
}
return Children.Count > 0;
}
示例3: FormalParam
public FormalParam(Position position, string/*!*/ name, object typeHint, bool passedByRef,
Expression initValue, List<CustomAttribute> attributes)
: base(position)
{
this.name = new VariableName(name);
this.typeHint = typeHint;
this.passedByRef = passedByRef;
this.initValue = initValue;
this.attributes = new CustomAttributes(attributes);
this.resolvedTypeHint = null;
}
示例4: FormalParam
public FormalParam(Text.Span span, string/*!*/ name, object typeHint, bool passedByRef,
Expression initValue, List<CustomAttribute> attributes)
: base(span)
{
Debug.Assert(typeHint == null || typeHint is PrimitiveTypeName || typeHint is GenericQualifiedName);
this.name = new VariableName(name);
this.typeHint = typeHint;
this.passedByRef = passedByRef;
this.initValue = initValue;
if (attributes != null && attributes.Count != 0)
this.Attributes = new CustomAttributes(attributes);
this.TypeHintPosition = Text.Span.Invalid;
}
示例5: CreateVariable
BoundVariable CreateVariable(VariableName name, VariableKind kind, Func<BoundExpression> initializer)
{
switch (kind)
{
case VariableKind.LocalVariable:
Debug.Assert(initializer == null);
return new BoundLocal(new SourceLocalSymbol(_routine, name.Value, kind));
case VariableKind.StaticVariable:
return new BoundStaticLocal(new SourceLocalSymbol(_routine, name.Value, kind), initializer?.Invoke());
case VariableKind.GlobalVariable:
Debug.Assert(initializer == null);
return new BoundGlobalVariable(name);
default:
Debug.Assert(initializer == null);
throw Roslyn.Utilities.ExceptionUtilities.UnexpectedValue(kind);
}
}
示例6: Parse
public override bool Parse(IItemFactory itemFactory, ITextProvider text, ITokenStream stream)
{
var name = new VariableName(SassClassifierType.VariableDefinition);
if (name.Parse(itemFactory, text, stream))
{
Name = name;
Children.Add(name);
}
if (stream.Current.Type == TokenType.Colon)
Colon = Children.AddCurrentAndAdvance(stream);
while (!IsValueTerminator(Mode, stream))
{
ParseItem item;
if (itemFactory.TryCreateParsedOrDefault(this, text, stream, out item))
{
Values.Add(item);
Children.Add(item);
}
}
if (stream.Current.Type == TokenType.Bang)
{
var modifier = new DefaultModifier();
if (modifier.Parse(itemFactory, text, stream))
{
Modifier = modifier;
Children.Add(modifier);
}
else
{
Children.AddCurrentAndAdvance(stream);
}
}
if (stream.Current.Type == TokenType.Semicolon)
Semicolon = Children.AddCurrentAndAdvance(stream);
return Children.Count > 0;
}
示例7: ConstantDecl
public ConstantDecl(Text.Span span, string/*!*/ name, Expression/*!*/ initializer)
: base(span)
{
this.name = new VariableName(name);
this.initializer = initializer;
}
示例8: NotifyListeners
/// <summary>
/// Notify all listeners that a variable in the model has been changed.
/// </summary>
private void NotifyListeners(VariableName v, object oldValue, object newValue)
{
lock(this)
{
lock(listeners)
{
foreach (IEditorListener l in listeners)
{
l.ModelChanged(v, oldValue, newValue);
}
}
}
}
示例9: PhpField
/// <summary>
/// Used by full reflection.
/// </summary>
public PhpField(VariableName name, DPropertyDesc/*!*/ fieldDesc, FieldInfo/*!*/ fieldInfo,
PropertyInfo exportedProperty)
: base(fieldDesc, name)
{
Debug.Assert(fieldDesc is DPhpFieldDesc);
this.realField = fieldInfo;
this.exportedProperty = exportedProperty;
this.hasInitialValue = realField.IsDefined(typeof(PhpHasInitValueAttribute), false);
this.builder = null;
this.implementor = DeclaringPhpType;
}
示例10: KnownProperty
/// <summary>
/// Used by subclasses.
/// </summary>
protected KnownProperty(DPropertyDesc/*!*/ propertyDesc, VariableName name)
: base(propertyDesc)
{
this.name = name;
// TODO
}
示例11: ClrField
/// <summary>
/// Used by full-reflect.
/// </summary>
public ClrField(VariableName/*!*/ name, ClrTypeDesc/*!*/ declaringType, PhpMemberAttributes memberAttributes,
FieldInfo/*!*/ fieldInfo)
: base(new DPropertyDesc(declaringType, memberAttributes), name)
{
this.fieldInfo = fieldInfo;
}
示例12: EmitEnsureStaticProperty
/// <summary>
/// Emits IL instructions that ensure that a static field is of <see cref="PhpObject"/> or <see cref="PhpArray"/>
/// type. Handles the case when field name is known at compile time (see <see cref="AST.DirectStFldUse"/>).
/// </summary>
/// <param name="property">The corresponding <see cref="DProperty"/> or <B>null</B>.</param>
/// <param name="typeRef">The class type reference (identifier index).</param>
/// <param name="fieldName">The field name (identifier index).</param>
/// <param name="ensureArray">Whether to ensure that static field is an array (or an object).</param>
/// <remarks>
/// Nothing is expected on the evaluation stack. A <see cref="PhpObject"/> or <see cref="DObject"/> is left
/// on the evaluation stack or the last emitted instruction is unconditional branch to <see cref="Chain.ErrorLabel"/>.
/// </remarks>
public PhpTypeCode EmitEnsureStaticProperty(DProperty property, TypeRef typeRef,
VariableName fieldName, bool ensureArray)
{
ILEmitter il = codeGenerator.IL;
PhpField php_field = property as PhpField;
if (php_field != null)
{
// HACK HACK
EmitEnsureStaticPhpFieldDirect(php_field, ensureArray);
EmitErrorCheck(ensureArray);
return (ensureArray) ? PhpTypeCode.PhpArray : PhpTypeCode.DObject;
}
else return EmitEnsureStaticProperty(typeRef, fieldName, null, ensureArray);
}
示例13: NamedActualParam
public NamedActualParam(Position position, string name, Expression/*!*/ expression)
: base(position)
{
this.name = new VariableName(name);
this.expression = expression;
}
示例14: ResolveClassConstantName
internal DConstant ResolveClassConstantName(DType/*!*/ type, VariableName constantName,
Position position, PhpType referringType, PhpRoutine referringRoutine, out bool checkVisibilityAtRuntime)
{
checkVisibilityAtRuntime = false;
// we cannot resolve a class constant unless we know the inherited members:
if (type.IsDefinite)
{
ClassConstant constant;
GetMemberResult member_result = type.GetConstant(constantName, referringType, out constant);
switch (member_result)
{
case GetMemberResult.OK:
return constant;
case GetMemberResult.NotFound:
ErrorSink.Add(Errors.UnknownClassConstantAccessed, SourceUnit, position, type.FullName, constantName);
return new UnknownClassConstant(type, constantName.Value);
case GetMemberResult.BadVisibility:
if (referringType == null && referringRoutine == null)
{
// visibility must be checked at run-time:
checkVisibilityAtRuntime = true;
return constant;
}
else
{
// definitive error:
if (constant.IsPrivate)
{
ErrorSink.Add(Errors.PrivateConstantAccessed, SourceUnit, position, type.FullName, constantName.Value,
referringType.FullName);
}
else
{
ErrorSink.Add(Errors.ProtectedConstantAccessed, SourceUnit, position, type.FullName, constantName.Value,
referringType.FullName);
}
return new UnknownClassConstant(type, constantName.Value);
}
default:
Debug.Fail();
throw null;
}
}
else
{
// warning (if any) reported by the type resolver:
return new UnknownClassConstant(type, constantName.Value);
}
}
示例15: ClrPropertyBase
/// <summary>
/// Used by full-reflect.
/// </summary>
public ClrPropertyBase(DPropertyDesc/*!*/ propertyDesc, VariableName name)
: base(propertyDesc, name)
{
}