public MethodInterface(LibraryDeclaration library, MethodImplementationType implementation, string name, bool isPublic, MethodKind kind, VarType returnType, MethodParameter[] parameters, string alias = null) { this.Name = name; this.Library = library; this.Implementation = implementation; this.Kind = kind; this.IsPublic = isPublic; this.ReturnType = returnType; this.Parameters = parameters; this.PreCallback = null; this.PostCallback = null; this.Contract = this.Library.Name; if (alias != null) { this.Alias = alias; } else { this.Alias = $"{char.ToUpper(this.Name[0])}{this.Name.Substring(1)}"; if (implementation == MethodImplementationType.ExtCall) { this.Alias = this.Library.Name + '.' + this.Alias; } } }
public MethodInterface AddMethod(string name, MethodImplementationType convention, VarType returnType, MethodParameter[] parameters, string alias = null) { if (!returnType.IsWeird && Compiler.Instance != null) { var vmType = MethodInterface.ConvertType(returnType); if (!ValidationUtils.IsValidMethod(name, vmType)) { throw new CompilerException("invalid method name: " + name); } } var method = new MethodInterface(this, convention, name, true, MethodKind.Method, returnType, parameters, alias); methods[name] = method; return(method); }
public MethodInterface AddMethod(string name, MethodImplementationType convention, VarKind returnKind, MethodParameter[] parameters, string alias = null) { return(AddMethod(name, convention, VarType.Find(returnKind), parameters, alias)); }