public static void AnnotateObject(IDiscreteBinding binding, string key, string value) { if (binding == null) { throw new ArgumentNullException("binding"); } binding.Annotate(key, value); }
public NativeCompiledInitializer(InitializerType type, IDiscreteBinding binding, Func <object, ExecutionContext, object> functionDelegate) : base(type, binding) { if (functionDelegate == null) { throw new ArgumentNullException("functionDelegate"); } this.Delegate = functionDelegate; }
protected override Expression GetExpression(ExecutionContext executionContext) { IDiscreteBinding binding = this.GetBindingStrategy.GetBinding(executionContext); if (binding == null) { throw new CodeGenerationException(String.Format("Could not find global binding {0}. This may indicate a bug in our code.", this.Moniker)); } return(Expression.Constant(binding, binding.GetType())); }
protected RuntimeCompiledInitializer(InitializerType type, IDiscreteBinding binding, InitializerNode parseTree, IDebugInfoService debugInfoService) : base(type, binding) { if (parseTree == null) { throw new ArgumentNullException(); } this.ParseTree = parseTree; this.DebugInfoService = debugInfoService; }
protected CompiledInitializer(InitializerType type, IDiscreteBinding binding) { if (type == InitializerType.ProgramInitializer) { if (binding != null) { throw new ArgumentException("ProgramInitializers must have null binding."); } } else if (type == InitializerType.ClassInitializer) { if (binding == null) { throw new ArgumentNullException("binding"); } if (!(binding is ClassBinding)) { throw new ArgumentException("ClassInitializers must have binding of type ClassBinding."); } } else if (type == InitializerType.GlobalInitializer) { if (binding == null) { throw new ArgumentNullException("binding"); } if (!(binding is GlobalVariableOrConstantBinding)) { throw new ArgumentException("ClassInitializers must have binding of type GlobalVariableOrConstantBinding."); } } else if (type == InitializerType.PoolVariableInitializer) { if (binding == null) { throw new ArgumentNullException("binding"); } if (!(binding is PoolVariableOrConstantBinding)) { throw new ArgumentException("ClassInitializers must have binding of type PoolVariableOrConstantBinding."); } } else { throw new ArgumentOutOfRangeException("type"); } this.Type = type; this.Binding = binding; }
private static CompiledInitializer AddInitializer(SmalltalkNameScope scope, InitializerType type, IDiscreteBinding binding, Type delegateType, string delegateName) { MethodInfo method = TypeUtilities.Method(delegateType, delegateName, BindingFlags.Public | BindingFlags.Static, NativeLoadHelper.InitializerDelegateTypes); Func <object, ExecutionContext, object> functionDelegate = (Func <object, ExecutionContext, object>)method.CreateDelegate(typeof(Func <object, ExecutionContext, object>)); NativeCompiledInitializer initializer = new NativeCompiledInitializer(type, binding, functionDelegate); scope.Initializers.Add(initializer); return(initializer); }