public bool ValidateMethod(MethodDefinition definition, IDefinitionInstallerContext installer, SmalltalkClass cls, CompiledMethod.MethodType methodType, ICodeValidationErrorSink errorSink)
        {
            RuntimeCompiledMethod method = (RuntimeCompiledMethod)this.CreateMethod(definition, installer, cls, methodType);

            return(method.Validate(installer.NameScope, this.GetErrorSink(errorSink)));
        }
예제 #2
0
        private static NativeCompiledMethod AddMethod(Dictionary <Symbol, CompiledMethod> dictionary, SmalltalkClass cls, string selector, Type containingType, string nativeName, CompiledMethod.MethodType methodType)
        {
            if (dictionary == null)
            {
                throw new ArgumentNullException("dictionary");
            }
            if (cls == null)
            {
                throw new ArgumentNullException("cls");
            }
            if (selector == null)
            {
                throw new ArgumentNullException("selector");
            }
            if (containingType == null)
            {
                throw new ArgumentNullException("containingType");
            }
            if (nativeName == null)
            {
                throw new ArgumentNullException("nativeName");
            }


            Symbol     sel          = cls.Runtime.GetSymbol(selector);
            MethodInfo nativeMethod = containingType.GetMethod(nativeName, BindingFlags.Public | BindingFlags.Static);

            if (nativeMethod == null)
            {
                throw new MissingMethodException(containingType.FullName, nativeName);
            }
            NativeCompiledMethod method = new NativeCompiledMethod(cls, sel, methodType, nativeMethod);

            dictionary.Add(sel, method);
            return(method);
        }
        public CompiledMethod CreateMethod(MethodDefinition definition, IDefinitionInstallerContext installer, SmalltalkClass cls, CompiledMethod.MethodType methodType)
        {
            Symbol selector = installer.Runtime.GetSymbol(this.ParseTree.Selector);

            return(new RuntimeCompiledMethod(cls, selector, methodType, this.ParseTree, new DebugInfoService(this.SourceCodeService)));
        }