code: public void addScriptFunction(ScriptPlacement placement, String script)
      {
          assert (script != null) : "The paramter 'script' must not be null";
          IScriptReporter sr = getParentScriptReporter();
          if (sr != null) {
              sr.addScriptFunction(placement, script);
              return;
          }
  
          // get the list of function blocks and add this script to it.
          if (placement == null || placement == ScriptPlacement.PLACE_INFRAMEWORK) {
              if (_funcBlocks == null) {
                  _funcBlocks = new ArrayList/*<String>*/();
              }
              assert (_funcBlocks != null) : "_funcBlocks should not be null";
              _funcBlocks.add(script);
          }
          else if (placement == ScriptPlacement.PLACE_BEFORE) {
              if (_codeBefore == null)
                  _codeBefore = new ArrayList/*<String>*/();
              _codeBefore.add(script);
          }
          else if (placement == ScriptPlacement.PLACE_AFTER) {
              if (_codeAfter == null)
                  _codeAfter = new ArrayList/*<String>*/();
              _codeAfter.add(script);
          }
          else {
              assert(false) : "unsupported placement:" + placement;
          }
      }
docs: This method will add Script as a function.
  @param placement
  @param script    the text of the function. This value must not be null.