Class ContextSensitiveCodeRunner


  • public class ContextSensitiveCodeRunner
    extends java.lang.Object
    • Field Detail

      • _cacheProgramByFingerprint

        private static java.util.concurrent.ConcurrentHashMap<java.lang.String,​IGosuProgramInternal> _cacheProgramByFingerprint
      • _refreshChecksum

        private static int _refreshChecksum
    • Constructor Detail

      • ContextSensitiveCodeRunner

        public ContextSensitiveCodeRunner()
    • Method Detail

      • ensureLoadedForDebuggerEval

        static void ensureLoadedForDebuggerEval()
      • runMeSomeCode

        public static java.lang.Object runMeSomeCode​(java.lang.Object enclosingInstance,
                                                     java.lang.ClassLoader cl,
                                                     java.lang.Object[] extSyms,
                                                     java.lang.String strText,
                                                     java.lang.String strClassContext,
                                                     java.lang.String strContextElementClass,
                                                     int iSourcePosition)
        Intended for use with a debugger to evaluate arbitrary expressions/programs in the context of a source position being debugged, usually at a breakpoint.
        Parameters:
        enclosingInstance - The instance of the object immediately enclosing the source position.
        extSyms - An array of adjacent name/value pairs corresponding with the names and values of local symbols in scope.
        strText - The text of the expression/program.
        strClassContext - The name of the top-level class enclosing the the source position.
        strContextElementClass - The name of the class immediately enclosing the source position (can be same as strClassContext).
        iSourcePosition - The index of the source position within the containing file.
        Returns:
        The result of the expression or, in the case of a program, the return value of the program.
      • _runMeSomeCode

        private static java.lang.Object _runMeSomeCode​(java.lang.Object enclosingInstance,
                                                       java.lang.Object[] extSyms,
                                                       java.lang.String strText,
                                                       java.lang.String strClassContext,
                                                       java.lang.String strContextElementClass,
                                                       int iSourcePosition)
      • compileAndRunMeSomeCode

        public static java.lang.Object compileAndRunMeSomeCode​(java.lang.Object source,
                                                               IGosuClass ctxClass,
                                                               java.lang.Object outer,
                                                               IType enclosingClass,
                                                               java.lang.Object[] extSyms,
                                                               int offset)
      • cacheProgram

        public static void cacheProgram​(java.lang.String strTypeName,
                                        IGosuProgramInternal program)
      • getCachedProgram

        public static IGosuProgramInternal getCachedProgram​(java.lang.String strTypeName)
      • clearCacheOnChecksumChange

        private static void clearCacheOnChecksumChange()
      • printArgs

        private static java.lang.String printArgs​(java.lang.Class[] parameterTypes)
      • printArgs

        private static java.lang.String printArgs​(java.util.List<java.lang.Object> args)
      • isBlock

        private static boolean isBlock​(java.lang.String fqn)
      • makeRuntimeNamesAndValues

        private static IExternalSymbolMap makeRuntimeNamesAndValues​(java.lang.Object[] extSyms)
      • collectLocalSymbols

        public static void collectLocalSymbols​(IType enclosingType,
                                               ISymbolTable symTable,
                                               IParsedElement parsedElement,
                                               int iOffset)
      • addThisSymbolForEnhancement

        private static void addThisSymbolForEnhancement​(IType enclosingType,
                                                        ISymbolTable symTable)
      • isProgramFieldVar

        private static boolean isProgramFieldVar​(IStatement stmt)