Uses 911K of libraries. Click here for Pure Java version (18021L/101K).
!7 cmodule FunctionInspector { S snippetID, source; LS functionNameList, returnTypesList; S functionNames; S safetyLevel, returnTypes, unknownIdentifiers; LPairS parameters; LLS functionDefs; start-thread { if (!dm_osBooting()) analyze(); } visual northCenterAndSouthWithMargins( jhgridWithSpacing( withLabel("Function names:", onEnter(dm_textField functionNames(), rThread { loadStandardFunction(functionNames) })), centerAndEastWithMargin(dm_fieldWithLabel snippetID(), jPopDownButton_noText( "Load function...", rThreadEnter { inputText("Standard function name", vf<S> loadStandardFunction); }, "Load snippet...", rThreadEnter { selectSnippetID(voidfunc(S snippetID) { loadFunctionFromSnippet(snippetID); }); }, "Analyze", rThreadEnter analyze))), dm_textAreaAsSection source(), vstackWithSpacing( jhgridWithSpacing( dm_fieldWithLabel safetyLevel(), dm_fieldWithLabel returnTypes()), dm_fieldWithLabel unknownIdentifiers())); // API void loadFunctionFromSnippet(S snippetID) enter { setField(+snippetID); setField(source := loadSnippet(snippetID)); analyze(); } void loadStandardFunction(S fname) enter { S snippetID = stdFunctions_cached().get(fname); if (snippetID != null) loadFunctionFromSnippet(snippetID); else infoBox("Standard function " + quote(fname) + " not found"); } void analyze { setField(functionNameList := uniquify(findFunctionDefinitions(source))); setField(functionNames := joinWithComma(functionNameList)); S mainFunction = first(functionNameList); LS tok = javaTok(source); setField(returnTypesList := map( s -> trim(tok_dropJavaAndJavaXModifiers(s)), tok_returnTypesOfStaticFunction_uncleaned(tok, mainFunction))); setField(returnTypes := joinWithComma(returnTypesList)); setField(functionDefs := findFullFunctionDefs(tok, true)); new Set<S> safety; new Set<S> unknownIdentifiers; for (LS tokF : functionDefs) { LS tokBody = tok_methodBody(tokF); safety.addAll(getCodeFragmentSafety(join(tokBody))); unknownIdentifiers.addAll(codeAnalysis_getUnknownIdentifiers(join(tokBody))); } setField(safetyLevel := joinWithComma(simplifySafetyTags(safety))); setField(unknownIdentifiers := joinWithComma(unknownIdentifiers)); } }
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1026715 |
Snippet name: | Function Inspector v1 [OK] |
Eternal ID of this version: | #1026715/33 |
Text MD5: | 78c6e5167313952b62d58e4b6c21a29e |
Transpilation MD5: | fda9f769ef2db5cf30d292b5f3ba5860 |
Author: | stefan |
Category: | |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-01-19 20:27:05 |
Source code size: | 2671 bytes / 74 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 217 / 750 |
Version history: | 32 change(s) |
Referenced in: | [show references] |