public override List <SD_Instance_Parameter> GetParameters() { return(referencedSymbol.GetParameters()); }
public override string Expand() { string comment = ""; if (SISettings.magicMethods_insertWithComments && UnitySymbols.summaries.Count > 0) { var commentKey = typeof(T).Name + '.' + name; if (UnitySymbols.summaries.TryGetValue(commentKey, out comment)) { comment = "// " + comment + "\n"; } else { comment = ""; } } string modifiers = contextType.IsSealed ? "" : "protected "; string baseCall = ""; if (baseSymbol != null) { modifiers += "new "; if (baseSymbol.kind == SymbolKind.Method) { baseCall = "base." + name + "("; var parameters = baseSymbol.GetParameters(); var separator = ""; foreach (var p in parameters) { baseCall += separator; baseCall += p.name; separator = ", "; } baseCall += ")"; var returnType = baseSymbol.TypeOf(); var baseIsCoroutine = returnType != null && returnType.name == "IEnumerator"; if (baseIsCoroutine) { baseCall = "StartCoroutine(" + baseCall + ")"; if (IsCoroutine) { baseCall = "yield return " + baseCall; } } baseCall += ";"; } } string expandedCode; expandedCode = string.Format("{0}{1}{2}{3}{{\n\t{4}$end$\n}}", comment, modifiers, signature, SISettings.magicMethods_openingBraceOnSameLine ? " " : "\n", baseCall); return(expandedCode); }
static SymbolDefinition FindNewSymbol(SymbolDefinition symbol) { if (symbol.kind == SymbolKind.Namespace) { return(symbol.Assembly.FindNamespace(symbol.FullName)); } if (symbol.parentSymbol == null) { return(symbol); } var newParent = FindNewSymbol(symbol.parentSymbol); if (newParent == null) { return(null); } var tp = symbol.GetTypeParameters(); var numTypeParams = tp != null ? tp.Count : 0; var symbolIsType = symbol.kind == SymbolKind.Class || symbol.kind == SymbolKind.Struct || symbol.kind == SymbolKind.Interface || symbol.kind == SymbolKind.Delegate || symbol.kind == SymbolKind.Enum; var newSymbol = newParent.FindName(symbol.name, numTypeParams, symbolIsType); if (newSymbol == null) { if (newParent.kind == SymbolKind.MethodGroup) { var mg = newParent as MethodGroupDefinition; if (mg == null) { var generic = newParent.GetGenericSymbol(); if (generic != null) { mg = generic as MethodGroupDefinition; } } if (mg != null) { var signature = symbol.PrintParameters(symbol.GetParameters(), true); foreach (var m in mg.methods) { var sig = m.PrintParameters(m.GetParameters(), true); if (sig == signature) { newSymbol = m; break; } } } } if (newSymbol == null) { Debug.LogWarning(symbol.GetTooltipText() + " not found in " + newParent.GetTooltipText()); return(null); } } return(newSymbol); }