本文整理汇总了C#中BlockParam类的典型用法代码示例。如果您正苦于以下问题:C# BlockParam类的具体用法?C# BlockParam怎么用?C# BlockParam使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BlockParam类属于命名空间,在下文中一共展示了BlockParam类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Invoke
// R(1, -)
public override object Invoke(BlockParam/*!*/ param, object self, object arg1) {
if (_parameterCount > 0) {
return InvokeSplatInternal(param, self, ArrayUtils.EmptyObjects, arg1); // TODO: optimize
} else {
return InvokeInternal(param, self, new object[] { arg1 }); // TODO: optimize
}
}
开发者ID:jcteague,项目名称:ironruby,代码行数:8,代码来源:BlockDispatcherUnsplatN.cs
示例2: InvokeInternal
private object InvokeInternal(BlockParam/*!*/ param, object self, object[]/*!*/ args) {
// TODO
if (args.Length < _parameterCount) {
Array.Resize(ref args, _parameterCount);
return _block(param, self, args, RubyOps.MakeArray0());
} else if (args.Length == _parameterCount) {
return _block(param, self, args, RubyOps.MakeArray0());
} else {
var actualArgs = new object[_parameterCount];
for (int i = 0; i < actualArgs.Length; i++) {
actualArgs[i] = args[i];
}
var array = new RubyArray(args.Length - _parameterCount);
for (int i = _parameterCount; i < args.Length; i++) {
array.Add(args[i]);
}
return _block(param, self, actualArgs, array);
}
}
开发者ID:jcteague,项目名称:ironruby,代码行数:22,代码来源:BlockDispatcherUnsplatN.cs
示例3: TopMethodMissing
// "method_missing" on main singleton in DLR Scope bound code.
// Might be called via a site -> needs to be public in partial trust.
public static object TopMethodMissing(RubyScope/*!*/ localScope, BlockParam block, object/*!*/ self, SymbolId name, [NotNull]params object[]/*!*/ args) {
return ScopeMethodMissing(localScope.RubyContext, localScope.GlobalScope.Scope, block, self, name, args);
}
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:5,代码来源:RubyScope.cs
示例4: InvokeSplatRhs
public abstract object InvokeSplatRhs(BlockParam/*!*/ param, object self, object[]/*!*/ args, object splattee, object rhs);
开发者ID:Hank923,项目名称:ironruby,代码行数:1,代码来源:BlockDispatcher.cs
示例5: Invoke
public abstract object Invoke(BlockParam/*!*/ param, object self, object[]/*!*/ args);
开发者ID:Hank923,项目名称:ironruby,代码行数:1,代码来源:BlockDispatcher.cs
示例6: InvokeNoAutoSplat
public abstract object InvokeNoAutoSplat(BlockParam/*!*/ param, object self, object arg1);
开发者ID:Hank923,项目名称:ironruby,代码行数:1,代码来源:BlockDispatcher.cs
示例7: TopMethodMissing
// method_missing on main singleton in DLR Scope bound code.
// Might be called via a site -> needs to be public in partial trust.
public static object TopMethodMissing(RubyScope/*!*/ scope, BlockParam block, object/*!*/ self, SymbolId name, [NotNull]params object[]/*!*/ args) {
Assert.NotNull(scope, self);
Debug.Assert(!scope.IsEmpty);
Scope globalScope = scope.GlobalScope.Scope;
Debug.Assert(globalScope != null);
// TODO: error when arguments non-empty, block != null, ...
// TODO: name-mangling
if (args.Length == 0) {
object value;
if (globalScope.TryGetName(name, out value)) {
return value;
}
} else if (args.Length == 1) {
string str = SymbolTable.IdToString(name);
if (str.Length > 0 && str[str.Length - 1] == '=') {
SymbolId plainName = SymbolTable.StringToId(str.Substring(0, str.Length - 1));
globalScope.SetName(plainName, args[0]);
return args[0];
}
}
// TODO: call super
throw RubyExceptions.CreateMethodMissing(scope.RubyContext, self, SymbolTable.IdToString(name));
}
开发者ID:joshholmes,项目名称:ironruby,代码行数:28,代码来源:RubyScope.cs
示例8: Invoke
// R(N, -)
public override object Invoke(BlockParam/*!*/ param, object self, object[]/*!*/ args) {
Debug.Assert(args.Length > MaxBlockArity);
return _block(param, self);
}
开发者ID:jcteague,项目名称:ironruby,代码行数:5,代码来源:BlockDispatchers.cs
示例9: InvokeSplatRhs
// R(N, *, =)
public override object InvokeSplatRhs(BlockParam/*!*/ param, object self, object[]/*!*/ args, object splattee, object rhs) {
var array = new RubyArray(args);
RubyOps.SplatAppend(array, splattee);
array.Add(rhs);
if (array.Count == 1) {
return _block(param, self, rhs);
}
Debug.Assert(array.Count >= 2);
if (!HasSingleCompoundParameter) {
param.MultipleValuesForBlockParameterWarning(array.Count);
}
return _block(param, self, array);
}
开发者ID:jcteague,项目名称:ironruby,代码行数:18,代码来源:BlockDispatchers.cs
示例10: InvokeSplat
// R(N, *)
public override object InvokeSplat(BlockParam/*!*/ param, object self, object[]/*!*/ args, object splattee) {
Debug.Assert(args.Length > MaxBlockArity);
return InvokeSplatInternal(param, self, RubyOps.MakeArrayN(args), splattee);
}
开发者ID:jcteague,项目名称:ironruby,代码行数:5,代码来源:BlockDispatchers.cs
示例11: InvokeSplatInternal
private object InvokeSplatInternal(BlockParam/*!*/ param, object self, RubyArray/*!*/ array, object splattee) {
Debug.Assert(array.Count >= 2);
RubyOps.SplatAppend(array, splattee);
if (!HasSingleCompoundParameter) {
param.MultipleValuesForBlockParameterWarning(array.Count);
}
return _block(param, self, array);
}
开发者ID:jcteague,项目名称:ironruby,代码行数:11,代码来源:BlockDispatchers.cs
示例12: InvokeNoAutoSplat
// R(1, -)
public override object InvokeNoAutoSplat(BlockParam/*!*/ param, object self, object arg1) {
return _block(param, self, arg1, null, null, null);
}
开发者ID:jcteague,项目名称:ironruby,代码行数:4,代码来源:BlockDispatchers.cs
示例13: InvokeSplat
public abstract object InvokeSplat(BlockParam/*!*/ param, object self, object arg1, object arg2, object arg3, object arg4, object splattee);
开发者ID:Hank923,项目名称:ironruby,代码行数:1,代码来源:BlockDispatcher.cs
示例14: RubyBlockScope
internal RubyBlockScope(MutableTuple locals, SymbolId[]/*!*/ variableNames,
BlockParam/*!*/ blockFlowControl, object selfObject, InterpretedFrame interpretedFrame) {
var parent = blockFlowControl.Proc.LocalScope;
// RuntimeFlowControl:
_activeFlowControlScope = parent.FlowControlScope;
// RubyScope:
_parent = parent;
_top = parent.Top;
_selfObject = selfObject;
_methodAttributes = RubyMethodAttributes.PublicInstance;
_locals = locals;
_variableNames = variableNames;
InterpretedFrame = interpretedFrame;
// RubyBlockScope:
_blockFlowControl = blockFlowControl;
}
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:19,代码来源:RubyScope.cs
示例15: ScopeMethodMissing
public static object ScopeMethodMissing(RubyContext/*!*/ context, Scope/*!*/ globalScope, BlockParam block, object self, SymbolId name, object[]/*!*/ args) {
Assert.NotNull(context, globalScope);
// TODO: invoke member:
string str = SymbolTable.IdToString(name);
if (str.LastCharacter() == '=') {
if (args.Length != 1) {
throw RubyOps.MakeWrongNumberOfArgumentsError(args.Length, 1);
}
// Consider this case:
// There is {"Foo" -> 1} in the scope.
// x.foo += 1
// Without name mangling this would result to {"Foo" -> 1, "foo" -> 2} while the expected result is {"Foo" -> 2}.
str = str.Substring(0, str.Length - 1);
if (!RubyOps.ScopeContainsMember(globalScope, str)) {
var unmangled = RubyUtils.TryUnmangleName(str);
if (unmangled != null && RubyOps.ScopeContainsMember(globalScope, unmangled)) {
str = unmangled;
}
}
var value = args[0];
RubyOps.ScopeSetMember(globalScope, str, value);
return value;
} else {
object result;
if (RubyOps.TryGetGlobalScopeMethod(context, globalScope, str, out result)) {
if (args.Length != 0) {
throw RubyOps.MakeWrongNumberOfArgumentsError(args.Length, 0);
}
return result;
}
if (self != null && str == "scope") {
if (args.Length != 0) {
throw RubyOps.MakeWrongNumberOfArgumentsError(args.Length, 0);
}
return self;
}
}
// TODO: call super
throw RubyExceptions.CreateMethodMissing(context, self, SymbolTable.IdToString(name));
}
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:48,代码来源:RubyScope.cs
注:本文中的BlockParam类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论