Used in execute_codegen to actually invoke the compiler with the proper arguments, and in
    _sources_to_be_generated to declare what the generated files will be.
500079
def _guess_package(self, path):
    
    supported_prefixes = ('com', 'org', 'net',)
    package = ''
    slash = path.rfind(os.path.sep)
    prefix_with_slash = max(path.rfind(os.path.join('', prefix, ''))
                            for prefix in supported_prefixes)
    if prefix_with_slash < 0:
      package = path[:slash]
    elif prefix_with_slash >= 0:
      package = path[prefix_with_slash:slash]
    package = package.replace(os.path.sep, ' ')
    package = package.strip().replace(' ', '.')
    return package
178118
public function afterGenerate() {
    foreach ($this->extension as $name => $generated) {
      file_put_contents(
        $this->directory->getRealPath() . DIRECTORY_SEPARATOR . $name . '.php',
        $generated
      );
    }
  }
217647
def _generate(self):
        

        needs_close = False

        if sys.hexversion >= 0x03000000:
            if self._opts.output == '-':
                from io import TextIOWrapper

                pyfile = TextIOWrapper(sys.stdout.buffer, encoding='utf8')
            else:
                pyfile = open(self._opts.output, 'wt', encoding='utf8')
                needs_close = True
        else:
            if self._opts.output == '-':
                pyfile = sys.stdout
            else:
                pyfile = open(self._opts.output, 'wt')
                needs_close = True

        import_from = self._opts.import_from

        if import_from:
            from_imports = True
        elif self._opts.from_imports:
            from_imports = True
            import_from = '.'
        else:
            from_imports = False

        compileUi(self._ui_file, pyfile, self._opts.execute, self._opts.indent,
                from_imports, self._opts.resource_suffix, import_from)

        if needs_close:
            pyfile.close()
446149
private void process() {
    if (hasExternsRoot()) {
      sourceKind = SourceKind.EXTERN;
      NodeTraversal.traverse(compiler, externsRoot, new BuildGlobalNamespace());
    }
    sourceKind = SourceKind.CODE;

    NodeTraversal.traverse(compiler, root, new BuildGlobalNamespace());
    generated = true;
    externsScope = null;
  }
274548
function genPugSourceMap (filename, compiled, options) {
  options = options || {}

  const basedir = options.root ? path.resolve(path.normalize(options.root)) : process.cwd()
  filename = path.resolve(basedir, path.normalize(filename))

  const reLineAndPath = /;pug_debug_line = ([0-9]+);pug_debug_filename = "([^"]*)";/
  const reEntryPoint  = /^function [$\w]+\(locals\)\{var pug_html\s*=/
  const compiledLines = compiled.split('\n')
  const debugSources  = extractSources(compiledLines)
  const matchedFiles  = {}
  let lineCount = 0
  let lastLine = -1

  if (!debugSources) {
    throw new Error('Cannot get the source code. Please compile with compileDebug:true.')
  }

  const mapGenerator = new SourceMapGenerator({
    file: relative(basedir, filename) + '.js',
  })

  // allow breakpoints in 1st line, better support is in To Do
  if (reEntryPoint.test(compiledLines[0])) {
    mapGenerator.addMapping({
      generated: { line: 1, column: 0 },
      original: { line: 1, column: 0 },
      source: relative(basedir, filename),
    })
  }

  compiledLines.forEach((line, lineno) => {
    lineCount++

    const match = line.match(reLineAndPath)
    if (!match) {
      return
    }

    const originalLine = ~~match[1]
    if (originalLine <= 0) {
      return
    }

    // avoid normalize the path here to match the name in debugSources
    const fname = match[2] && match[2].replace(/\\u002F/g, '/').replace(/\\\\/g, '\\') || filename

    let matchedLines = matchedFiles[fname]
    if (!matchedLines) {
      // new included file - add source content
      matchedFiles[fname] = matchedLines = []

      if (!options.excludeContent) {
        addSourceContent(mapGenerator, basedir, fname, debugSources)
      }
    }

    // remove pug debug line from generated code, adjust line counter
    if (!options.keepDebugLines) {
      const len = match[0].length

      compiledLines[lineno] = line.length === len
        ? '' : line.slice(0, match.index) + line.slice(match.index + len)
      if (!compiledLines[lineno].trim()) {
        compiledLines[lineno] = '\0'
        lineCount--
      }
    }

    // have a recognized generated line?
    if (!/^;pug_debug/.test(compiledLines[lineno + 1])) {
      let generatedLine = lineCount + 1

      lastLine = lineno + 1
      if (compiledLines[lastLine].slice(0, 2) === '//' &&
          compiledLines[lastLine + 1] === ';(function(){') {
        generatedLine++
        lastLine++
      }

      // adds the new mapping if line is not matched yet
      if (matchedLines.indexOf(originalLine) < 0) {
        matchedLines.push(originalLine)
        mapGenerator.addMapping({
          generated: {
            line: generatedLine,
            column: 0,
          },
          original: {
            line: originalLine,
            column: 0,
          },
          source: relative(basedir, fname),
        })
      }
    }
  })

  // use the resulting non-empty lines to recreate the code
  if (!options.keepDebugLines) {

    // split the last row having the root catch clause
    if (~lastLine) {
      const line = compiledLines[lastLine]
      const pos = line.lastIndexOf(';}.call(this,') + 1
      if (pos && line.lastIndexOf('rethrow(err,') > pos) {
        compiledLines[lastLine] = line.slice(0, pos) + '\n' + line.slice(pos)
      }
    }

    compiled = compiledLines.filter((line) => line !== '\0').join('\n')
  }

  return { data: compiled, map: mapGenerator.toJSON() }
}
825620
public final <T1 extends SourceFile, T2 extends SourceFile> void init(
      List<T1> externs, List<T2> sources, CompilerOptions options) {
    JSModule module = new JSModule(JSModule.STRONG_MODULE_NAME);
    for (SourceFile source : sources) {
      module.add(new CompilerInput(source));
    }

    List<JSModule> modules = new ArrayList<>(1);
    modules.add(module);
    initModules(externs, modules, options);
    addFilesToSourceMap(sources);
  }
479711
def code(self):
    """"""
    return compile(self.source(), self.full_path, 'exec', flags=0, dont_inherit=True)
1276363
def compile(self, source_code, post_treatment=''.join, source='<string>', target='exec'): 
        """"""
        self.last_python_code = super().compile(source_code, post_treatment)
        return PyCompiler.executable(self.last_python_code, source, target)
649723
function generateCustomOutputs(done) {

			if (!o.customOutputs || o.customOutputs.length < 1) {
				done();
				return;
			}

			_.each(o.customOutputs, generateCustomOutput);
			done();
		}
72606
public static void generateSource(File file, File sourceOutputPath, List<CodeDependent> cds,
            Set<String> compiledClass) throws IOException {

        doCreatePro(file, true, false, null, true, sourceOutputPath, cds, compiledClass, new HashMap<String, String>(),
                false);
    }
1240031
def compile_func(arg_names, statements, name='_the_func', debug=False):
    
    func_def = ast.FunctionDef(
        name=name,
        args=ast.arguments(
            args=[ast.arg(arg=n, annotation=None) for n in arg_names],
            kwonlyargs=[],
            kw_defaults=[],
            defaults=[ex_literal(None) for _ in arg_names],
        ),
        body=statements,
        decorator_list=[],
    )

    mod = ast.Module([func_def])
    ast.fix_missing_locations(mod)

    prog = compile(mod, '<generated>', 'exec')

    # Debug: show bytecode.
    if debug:
        dis.dis(prog)
        for const in prog.co_consts:
            if isinstance(const, types.CodeType):
                dis.dis(const)

    the_locals = {}
    exec(prog, {}, the_locals)
    return the_locals[name]
1359978
void generate(T input) throws SourceFileGenerationException {
    ClassName generatedTypeName = nameGeneratedType(input);
    try {
      Optional<TypeSpec.Builder> type = write(generatedTypeName, input);
      if (!type.isPresent()) {
        return;
      }
      buildJavaFile(generatedTypeName, type.get()).writeTo(filer);
    } catch (Exception e) {
      // if the code above threw a SFGE, use that
      Throwables.propagateIfPossible(e, SourceFileGenerationException.class);
      // otherwise, throw a new one
      throw new SourceFileGenerationException(
          Optional.<ClassName>absent(), e, getElementForErrorReporting(input));
    }
  }
897361
def build!
      create_output_directory
      spec.source_directories.each { |d| simple_compile_directory(d) }
      compile_files(spec.all_javascript_paths)
      compile_files(spec.all_stylesheet_paths)
      write_manifest
    end
429973
def execute(self):
    """"""

    def is_cc(source):
      _, ext = os.path.splitext(source)
      return ext in self.get_options().cc_extensions

    targets = self.context.targets(self.is_cpp)

    # Compile source files to objects.
    with self.invalidated(targets, invalidate_dependents=True) as invalidation_check:
      obj_mapping = self.context.products.get('objs')
      for vt in invalidation_check.all_vts:
        for source in vt.target.sources_relative_to_buildroot():
          if is_cc(source):
            if not vt.valid:
              with self.context.new_workunit(name='cpp-compile', labels=[WorkUnitLabel.MULTITOOL]):
                # TODO: Parallelise the compilation.
                # TODO: Only recompile source files that have changed since the
                #       object file was last written. Also use the output from
                #       gcc -M to track dependencies on headers.
                self._compile(vt.target, vt.results_dir, source)
            objpath = self._objpath(vt.target, vt.results_dir, source)
            obj_mapping.add(vt.target, vt.results_dir).append(objpath)
640618
def _generate_code(self, source):
        

        if not isinstance(source, str_class):
            raise PybarsError("Template source must be a unicode string")

        tree, (position, _) = self._handlebars(source).apply('template')

        self.clean_whitespace(tree)

        if debug:
            print('\nAST')
            print('---')
            print(tree)
            print('')

        if position < len(source):
            line_num = source.count('\n') + 1
            beginning_of_line = source.rfind('\n', 0, position)
            if beginning_of_line == -1:
                char_num = position
            else:
                char_num = position - beginning_of_line
            word = self._extract_word(source, position)
            raise PybarsError("Error at character %s of line %s near %s" % (char_num, line_num, word))

        # Ensure the builder is in a clean state - kinda gross
        self._compiler.globals['builder']._reset()

        output = self._compiler(tree).apply('compile')[0]
        return output
507337
def generate_file(fname, ns_func, dest_dir="."):
    """"""
    with open(pjoin(root, 'buildutils', 'templates', '%s' % fname), 'r') as f:
        tpl = f.read()
    out = tpl.format(**ns_func())
    dest = pjoin(dest_dir, fname)
    info("generating %s from template" % dest)
    with open(dest, 'w') as f:
        f.write(out)
739084
function compile( src ) {
    var watch  = arguments.length <= 1 || arguments[1] === void 0 ? true : arguments[1];
    var parent = arguments.length <= 2 || arguments[2] === void 0 ? null : arguments[2];

    var script = new SourceScript( src, parent );

    if( watch ) {
        script.watch();
    }

    return script;
}