本文整理汇总了C#中SymbolId类的典型用法代码示例。如果您正苦于以下问题:C# SymbolId类的具体用法?C# SymbolId怎么用?C# SymbolId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SymbolId类属于命名空间,在下文中一共展示了SymbolId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Define
public void Define(SymbolId name, Definition definition)
{
if (name != SymbolTable.Empty)
{
current.Define(name, definition);
}
}
示例2: Contains
public override bool Contains(SymbolId key) {
if (_data == null) return false;
lock (this) {
return _data.ContainsKey(key);
}
}
示例3: TryGetPackageAny
public MemberTracker TryGetPackageAny(SymbolId name) {
MemberTracker ret;
if (TryGetValue(name, out ret)) {
return ret;
}
return null;
}
示例4: PythonTypeChangedEventArgs
public PythonTypeChangedEventArgs(CodeContext context, SymbolId changed, ChangeType type, object previous, object newValue) {
_context = context;
_changed = changed;
_type = type;
_previous = previous;
_newValue = newValue;
}
示例5: TryGetPackage
public NamespaceTracker TryGetPackage(SymbolId name) {
NamespaceTracker pm = TryGetPackageAny(name) as NamespaceTracker;
if (pm != null) {
return pm;
}
return null;
}
示例6: TryGetExtraValue
protected override bool TryGetExtraValue(SymbolId key, out object value)
{
var property = _viewType.GetProperty(key.ToString());
if (property != null)
{
value = property.GetValue(_view, null);
return true;
}
var field = _viewType.GetField(key.ToString());
if (field != null)
{
value = field.GetValue(_view);
return true;
}
var method = _viewType.GetMethod(key.ToString());
if (method != null)
{
var parameterTypes = method.GetParameters().Select(p => p.ParameterType).ToList();
parameterTypes.Add(method.ReturnType);
value = Delegate.CreateDelegate(
CompilerHelpers.MakeCallSiteDelegateType(parameterTypes.ToArray()),
_view,
key.ToString());
return true;
}
if (_view.TryGetViewData(key.ToString(), out value))
return true;
value = null;
return false;
}
示例7: PythonVariable
public PythonVariable(SymbolId name, Type/*!*/ type, VariableKind kind, ScopeStatement/*!*/ scope) {
Assert.NotNull(type, scope);
_name = name;
_type = type;
_kind = kind;
_scope = scope;
}
示例8: Add
public override void Add(SymbolId key, object value) {
lock (this) {
EnsureData();
_data[key] = value;
}
}
示例9: FromImportStatement
public FromImportStatement(ModuleName root, SymbolId[] names, SymbolId[] asNames, bool fromFuture, bool forceAbsolute) {
_root = root;
_names = names;
_asNames = asNames;
_fromFuture = fromFuture;
_forceAbsolute = forceAbsolute;
}
示例10: CreateSlot
protected override Slot CreateSlot(SymbolId name, Type type)
{
FieldBuilder fb = _typeGen.TypeBuilder.DefineField(SymbolTable.IdToString( name),
type, FieldAttributes.Assembly | FieldAttributes.Static);
return new StaticFieldSlot(fb);
}
示例11: Method
public static object Method(object[] args)
{
Debug.Assert(args.Length >= 3, "A call to «method» should have at least two parameters: the name of the method and its block");
Debug.Assert(args[0] is DictionaryBonsaiFunction);
for (int i = 1; i < args.Length - 1; i++)
Debug.Assert(args[i] is SymbolId, "Argument " + i + " should be a SymbolId");
Debug.Assert(args[args.Length - 1] is BlockBonsaiFunction, "The last arguments should be a block");
var scope = (DictionaryBonsaiFunction)args[0];
var name = (SymbolId)args[1];
var block = (BlockBonsaiFunction)args[args.Length - 1];
var self = (BonsaiPrototypeFunction)scope["self"];
var parameters = new SymbolId[args.Length - 3];
for (int i = 2; i < args.Length - 1; i++)
parameters[i - 2] = (SymbolId)args[i];
self[name] = new DelegateBonsaiFunction(callArgs => {
Debug.Assert(callArgs.Length - 1 == parameters.Length, "The number of arguments should equal the number of parameters");
var blockLocalVariables = new DictionaryBonsaiFunction();
for (int i = 0; i < parameters.Length; i++) {
blockLocalVariables[parameters[i]] = callArgs[i + 1];
}
var callSelf = ((DictionaryBonsaiFunction)callArgs[0])["self"];
blockLocalVariables["self"] = callSelf;
return block.Invoke(blockLocalVariables);
});
return self[name];
}
示例12: BonsaiPrototypeFunction
public BonsaiPrototypeFunction(SymbolId? name = null, BonsaiPrototypeFunction prototype = null)
: base(null)
{
if (name.HasValue)
this.Name = name.Value;
else
this.Name = "«unnamed»".ToSymbol();
if (prototype == null) {
foreach (MethodInfo method in this.GetType().GetMethods(
BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static )) {
var attrs = method.GetCustomAttributes(typeof(MapsToSymbolAttribute), false);
foreach (MapsToSymbolAttribute mapper in attrs) {
this.Dict.Add(
mapper.Symbol,
new DelegateBonsaiFunction((Func<object[], object>)Delegate.CreateDelegate(
typeof(Func<object[], object>),
method.IsStatic ? null : this,
method)));
}
}
} else {
this.Dict = new SortedList<SymbolId, object>(prototype.Dict);
}
}
示例13: ComparisonPattern
public ComparisonPattern(SymbolId symbol, object testedValue)
{
if (!(testedValue is IComparable))
throw new ArgumentException("testedValue must be IComparable", "testedValue");
this.ParameterName = symbol;
this.TestedValue = testedValue;
}
示例14: TryGetPackageLazy
public MemberTracker TryGetPackageLazy(SymbolId name) {
MemberTracker ret;
if (_dict.TryGetValue(SymbolTable.IdToString(name), out ret)) {
return ret;
}
return null;
}
示例15: PythonGlobal
public PythonGlobal(CodeContext/*!*/ context, SymbolId name) {
Assert.NotNull(context);
_value = Uninitialized.Instance;
_context = context;
_name = name;
}