Ejemplo n.º 1
0
 private JsImplMemberInfo GetAttributeTarget(string memberType, string memberName)
 {
     if (memberType == "type")
     {
         return(this);
     }
     else if (memberType == "method")
     {
         var methodName = JsNamingHelper.JsFunctionNameToClrMethodName(memberName);
         var methods    = GetMethods(methodName);
         foreach (var method in methods)
         {
             if (method.JsName == memberName)                     //TODO: optimize?
             {
                 return(method);
             }
         }
         return(null);
     }
     else if (memberType == "property")
     {
         return(GetProperty(memberName));
     }
     else
     {
         throw new NotImplementedException("GetAttributeTarget not supported yet for memberType: " + memberType);
     }
 }
Ejemplo n.º 2
0
        void FillMethods(JsObject def)
        {
            var isStatic = def == _JsType.staticDefinition;

            foreach (var funcName in def)
            {
                if (funcName == "toString")
                {
                    continue;
                }
                var func = def[funcName].As <JsFunction>();
                if (Js.Typeof(func) != "function")
                {
                    continue;
                }
                var methodName = JsNamingHelper.JsFunctionNameToClrMethodName(funcName);
                var methods    = _MethodsByName[methodName];
                if (methods == null)
                {
                    methods = new JsArray <MethodInfo>();
                    _MethodsByName[methodName] = methods;
                }
                //TODO: check overrides and parameters
                var method = new JsImplMethodInfo();
                methods.push(method.As <MethodInfo>());
                _Methods.push(method);
                method._Name          = methodName;
                method.JsName         = funcName;
                method.JsFunction     = func;
                method._DeclaringType = this;
                method._IsStatic      = _JsType.staticDefinition != null && _JsType.staticDefinition[funcName] == func;
                //var propType = VM.resolveMemberType2(def, propName);
                //if (propType != null)
                //  prop._MethodType = _TypeOf(propType);
            }
        }