本文整理汇总了C#中SymbolId.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# SymbolId.GetString方法的具体用法?C# SymbolId.GetString怎么用?C# SymbolId.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymbolId
的用法示例。
在下文中一共展示了SymbolId.GetString方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindInParent
internal bool BindInParent(SymbolId name, Binder binder)
{
Binding binding;
ContainsNestedFreeVariables = true;
if (TryGetBinding(name, out binding)) {
if (binding.IsGlobal) {
return false;
} else {
if (binding.IsDeleted) {
binder.ReportSyntaxError(string.Format("can not delete variable '{0}' referenced in nested scope", name.GetString()), this);
}
MakeEnvironment(name);
HasEnvironment = true;
return true;
}
}
if (parent != null) {
if (parent.BindInParent(name, binder)) {
IsClosure = true;
HasEnvironment = true;
return true;
}
}
return false;
}
示例2: InferMethods
public override IList<FunctionInfo> InferMethods(SymbolId name)
{
Initialize();
List<ReflectedMember> list;
IList<FunctionInfo> result = null;
if (members.TryGetValue(name, out list)) {
foreach (ReflectedMember member in list) {
ReflectedMethod method = member as ReflectedMethod;
if (null != method) {
result = Engine.Union<FunctionInfo>(result, method.InferMethods(name));
}
}
} else if (type.Name == name.GetString()) {
members.TryGetValue(SymbolTable.StringToId(".ctor"), out list);
foreach (ReflectedMember member in list) {
ReflectedConstructor constructor = member as ReflectedConstructor;
if (constructor != null) {
result = Engine.Union<FunctionInfo>(result, constructor.InferMethods(name));
}
}
}
return result;
}
示例3: MakeSlot
public override Slot MakeSlot(SymbolId name, Type type)
{
FieldBuilder fb = typeGen.myType.DefineField(name.GetString(), type, FieldAttributes.Public);
return new FieldSlot(instance, fb);
}
示例4:
public Slot this[SymbolId name]
{
get {
Debug.Assert(slots.ContainsKey(name), "undefined slot: " + name.GetString());
return slots[name];
}
set {
Debug.Assert(!slots.ContainsKey(name), "slot override: " + name.GetString());
slots[name] = value;
}
}
示例5: GetPropertyHelper
public static object GetPropertyHelper(object prop, object instance, SymbolId name)
{
IDescriptor desc = prop as IDescriptor;
if (desc == null) {
throw Ops.TypeError("Expected property for {0}, but found {1}",
name.GetString(), Ops.GetDynamicType(prop).__name__);
}
return desc.GetAttribute(instance, null);
}
示例6: SetPropertyHelper
public static void SetPropertyHelper(object prop, object instance, object newValue, SymbolId name)
{
IDataDescriptor desc = prop as IDataDescriptor;
if (desc == null) {
throw Ops.TypeError("Expected settable property for {0}, but found {1}",
name.GetString(), Ops.GetDynamicType(prop).__name__);
}
desc.SetAttribute(instance, newValue);
}
示例7: AddRemoveEventHelper
public static void AddRemoveEventHelper(object method, object instance, UserType context, object eventValue, SymbolId name)
{
object callable = Ops.GetDescriptor(method, instance, context);
if (!Ops.IsCallable(callable)) {
throw Ops.TypeError("Expected callable value for {0}, but found {1}", name.GetString(),
Ops.GetDynamicType(method).Name);
}
Ops.Call(callable, eventValue);
}
示例8: FixName
private SymbolId FixName(SymbolId name)
{
if (privatePrefix != null && IsPrivateName(name)) {
name = SymbolTable.StringToId(string.Format("_{0}{1}", privatePrefix, name.GetString()));
}
return name;
}
示例9: CheckUniqueParameter
private void CheckUniqueParameter(Dictionary<SymbolId, SymbolId> names, SymbolId name)
{
if (names.ContainsKey(name)) {
ReportSyntaxError(string.Format("duplicate argument '{0}' in function definition", name.GetString()));
}
names[name] = name;
}
示例10: IsPrivateName
private static bool IsPrivateName(SymbolId name)
{
string s = name.GetString();
return s.StartsWith("__") && !s.EndsWith("__");
}
示例11: SetPrivatePrefix
public string SetPrivatePrefix(SymbolId name)
{
// Remove any leading underscores before saving the prefix
string oldPrefix = privatePrefix;
if (name != SymbolTable.Empty) {
string prefixString = name.GetString();
for (int i = 0; i < prefixString.Length; i++) {
if (prefixString[i] != '_') {
privatePrefix = prefixString.Substring(i);
return oldPrefix;
}
}
}
// Name consists of '_'s only, no private prefix mapping
privatePrefix = null;
return oldPrefix;
}