Wren.Core.Objects.ObjClass.BindMethod C# (CSharp) Method

BindMethod() public method

public BindMethod ( int symbol, Method method ) : void
symbol int
method Method
return void
        public void BindMethod(int symbol, Method method)
        {
            if (symbol >= Methods.Length)
            {
                ResizeMethods(symbol);
            }
            Methods[symbol] = method;
        }

Usage Example

示例#1
0
        // Defines [methodValue] as a method on [classObj].
        private static Value BindMethod(MethodType methodType, int symbol, ObjClass classObj, Value methodContainer)
        {
            ObjFn methodFn = methodContainer.Obj as ObjFn ?? ((ObjClosure)methodContainer.Obj).Function;

            // Methods are always bound against the class, and not the metaclass, even
            // for static methods, because static methods don't have instance fields
            // anyway.
            Compiler.BindMethodCode(classObj, methodFn);

            Method method = new Method { mType = MethodType.Block, obj = methodContainer.Obj };

            if (methodType == MethodType.Static)
                classObj = classObj.ClassObj;

            //classObj.Methods[symbol] = method;
            classObj.BindMethod(symbol, method);
            return new Value (ValueType.Null);
        }
All Usage Examples Of Wren.Core.Objects.ObjClass::BindMethod