static string GetCodeTypeReferenceText(CodeTypeReference codeTypeReference) { return(TypeMapper.MapCodeTypeReferenceToTsText(codeTypeReference)); }
internal static void GenerateCodeFromExpression(CodeExpression e, TextWriter w, CodeGeneratorOptions o) { if (e == null) { return; } var argumentReferenceExpression = e as CodeArgumentReferenceExpression; if (argumentReferenceExpression != null) { w.Write(argumentReferenceExpression.ParameterName); return; } if (WriteCodeArrayCreateExpression(e as CodeArrayCreateExpression, w, o)) { return; } if (WriteCodeArrayIndexerExpression(e as CodeArrayIndexerExpression, w, o)) { return; } var baseReferenceExpression = e as CodeBaseReferenceExpression; if (baseReferenceExpression != null) { w.Write("super"); return; } if (WriteCodeBinaryOperatorExpression(e as CodeBinaryOperatorExpression, w, o)) { return; } if (WriteCodeFieldReferenceExpression(e as CodeFieldReferenceExpression, w, o)) { return; } if (WriteCodeIndexerExpression(e as CodeIndexerExpression, w, o)) { return; } if (WriteCodeMethodInvokeExpression(e as CodeMethodInvokeExpression, w, o)) { return; } var methodReferenceExpression = e as CodeMethodReferenceExpression; if (methodReferenceExpression != null) { WriteCodeMethodReferenceExpression(methodReferenceExpression, w, o); return; } if (WriteCodeObjectCreateExpression(e as CodeObjectCreateExpression, w, o)) { return; } var parameterDeclarationExpression = e as CodeParameterDeclarationExpression; if (parameterDeclarationExpression != null) { w.Write($"{parameterDeclarationExpression.Name}: {TypeMapper.MapCodeTypeReferenceToTsText(parameterDeclarationExpression.Type)}"); return; } if (WriteCodePrimitiveExpression(e as CodePrimitiveExpression, w)) { return; } if (WriteCodePropertyReferenceExpression(e as CodePropertyReferenceExpression, w, o)) { return; } var snippetExpression = e as CodeSnippetExpression; if (snippetExpression != null) { w.Write(snippetExpression.Value); return; } var thisReferenceExpression = e as CodeThisReferenceExpression; if (thisReferenceExpression != null) { w.Write("this"); return; } var typeOfExpression = e as CodeTypeOfExpression; if (typeOfExpression != null) { w.Write("typeof " + TypeMapper.MapCodeTypeReferenceToTsText(typeOfExpression.Type)); return; } var typeReferenceExpression = e as CodeTypeReferenceExpression; if (typeReferenceExpression != null) { w.Write(TypeMapper.MapCodeTypeReferenceToTsText(typeReferenceExpression.Type)); return; } var variableReferenceExpression = e as CodeVariableReferenceExpression; if (variableReferenceExpression != null) { w.Write(variableReferenceExpression.VariableName); return; } Trace.TraceWarning($"CodeExpression not supported: {e.ToString()}"); }
string ICodeGenerator.GetTypeOutput(CodeTypeReference type) { return(TypeMapper.MapCodeTypeReferenceToTsText(type)); }