public IMethodRegister GetMethodRegister(string className, bool isStatic, ClepsType functionType, string functionName) { string classNameToUse = isStatic ? className + ".static" : className; FunctionNameAndType methodRegisterKey = new FunctionNameAndType(classNameToUse, functionName, functionType); return(methodBodies[methodRegisterKey]); }
public IMethodRegister CreateMethod(string className, bool isStatic, ClepsType functionType, string functionName) { if (!classesLoaded.ContainsKey(className)) { throw new ArgumentException(String.Format("Class {0} not loaded", className)); } if (!functionType.IsFunctionType) { throw new ArgumentException("Expected function type. Got " + functionType.GetClepsTypeString()); } var classNameToUse = isStatic ? className + ".static" : className; var functionNameAndType = new FunctionNameAndType(classNameToUse, functionName, functionType); var methodList = isStatic ? staticMethods[classNameToUse] : memberMethods[classNameToUse]; if (methodList.Contains(functionNameAndType)) { throw new ArgumentException(String.Format("Function {0} {1} {2} for class {3} already exists", isStatic ? "static" : "", functionType, functionName, className)); } methodList.Add(functionNameAndType); var methodRegister = new JavaScriptMethod(functionType as FunctionClepsType); methodBodies.Add(functionNameAndType, methodRegister); return(methodRegister); }