Esempio n. 1
0
        public void ProcessAssembly()
        {
            var callbackMethods = _mainModule.GetTypes().SelectMany(item => item.Methods).Where(method =>
                                                                                                method.HasCustomAttributes &&
                                                                                                method.CustomAttributes.Any(attr => attr.AttributeType.Name == nameof(JsCallback)));
            var functionMethods = _mainModule.GetTypes().SelectMany(item => item.Methods).Where(method =>
                                                                                                method.HasCustomAttributes &&
                                                                                                method.CustomAttributes.Any(attr => attr.AttributeType.Name == nameof(JsFunction)));

            SerializationClassCodegen serialization = new SerializationClassCodegen(_mainModule, _typeHelper);

            CallbackCodegen callbackCodegen = new CallbackCodegen(_typeHelper, serialization);

            foreach (var callbackMethod in callbackMethods)
            {
                callbackCodegen.ProcessMethod(callbackMethod);
            }

            FunctionCodegen functionCodegen = new FunctionCodegen(_typeHelper, serialization);

            foreach (var function in functionMethods)
            {
                functionCodegen.ProcessMethod(function);
            }
        }
 public CallbackCodegen(TypeHelpersCollection typeHelper, SerializationClassCodegen serialization)
 {
     _typeHelper    = typeHelper;
     _serialization = serialization;
 }