TODO: Refactor to non-classic mode
423853
def folderitems(self):
        
        items = super(ARTemplateAnalysesView, self).folderitems()
        self.categories.sort()
        return items
412742
def method_missing(sym, *args, &block)
      if self.internal_object.key?(sym.to_s)
        return self.internal_object[sym.to_s]
      end

      super
    end
1157392
function applyNew(cls, args) {
    args = _.toArray(args);
    args.unshift(null);
    return new (cls.bind.apply(cls, args));
  }
1364928
public function beforeCompile(): void
	{
		$builder = $this->getContainerBuilder();
		$config = $this->validateConfig($this->defaults);

		if ($builder->getByType(ILatteFactory::class) === null) {
			throw new LatteDefinitionNotFoundException();
		}

		if ($config['generated'] === true) {
			$config['rev'] = md5(microtime() . random_int(0, 100));
			$config['build'] = md5(microtime() . random_int(0, 100));
			$config['v'] = md5(microtime() . random_int(0, 100));
		}

		$builder->getDefinitionByType(ILatteFactory::class)
			->addSetup('?->onCompile[] = function ($engine) { ?::install($engine->getCompiler(), ?); }', [
				'@self',
				new PhpLiteral(VersionMacros::class),
				$config,
			]);
	}
826330
private static MethodHandle unmapJava7Or8(MethodHandles.Lookup lookup) throws ReflectiveOperationException
  {
    // "Compile" a MethodHandle that is roughly equivalent to the following lambda:
    //
    // (ByteBuffer buffer) -> {
    //   sun.misc.Cleaner cleaner = ((java.nio.DirectByteBuffer) byteBuffer).cleaner();
    //   if (nonNull(cleaner))
    //     cleaner.clean();
    //   else
    //     noop(cleaner); // the noop is needed because MethodHandles#guardWithTest always needs both if and else
    // }
    //
    Class<?> directBufferClass = Class.forName("java.nio.DirectByteBuffer");
    Method m = directBufferClass.getMethod("cleaner");
    m.setAccessible(true);
    MethodHandle directBufferCleanerMethod = lookup.unreflect(m);
    Class<?> cleanerClass = directBufferCleanerMethod.type().returnType();
    MethodHandle cleanMethod = lookup.findVirtual(cleanerClass, "clean", MethodType.methodType(void.class));
    MethodHandle nonNullTest = lookup.findStatic(Objects.class, "nonNull",
                                                 MethodType.methodType(boolean.class, Object.class)
    ).asType(MethodType.methodType(boolean.class, cleanerClass));
    MethodHandle noop = MethodHandles.dropArguments(MethodHandles.constant(
        Void.class,
        null
    ).asType(MethodType.methodType(void.class)), 0, cleanerClass);
    MethodHandle unmapper = MethodHandles.filterReturnValue(
        directBufferCleanerMethod,
        MethodHandles.guardWithTest(nonNullTest, cleanMethod, noop)
    ).asType(MethodType.methodType(void.class, ByteBuffer.class));
    return unmapper;
  }
767840
function bootstrap(bootstrapModules) {

  var modules = [],
      components = [];

  function hasModule(m) {
    return modules.indexOf(m) >= 0;
  }

  function addModule(m) {
    modules.push(m);
  }

  function visit(m) {
    if (hasModule(m)) {
      return;
    }

    (m.__depends__ || []).forEach(visit);

    if (hasModule(m)) {
      return;
    }

    addModule(m);

    (m.__init__ || []).forEach(function(c) {
      components.push(c);
    });
  }

  bootstrapModules.forEach(visit);

  var injector = new Injector(modules);

  components.forEach(function(c) {

    try {
      // eagerly resolve component (fn or string)
      injector[typeof c === 'string' ? 'get' : 'invoke'](c);
    } catch (e) {
      console.error('Failed to instantiate component');
      console.error(e.stack);

      throw e;
    }
  });

  return injector;
}
317074
function runtime(helpers, context, templateFunction) {
  return guard(templateFunction(helpers, context, guard, iter, helper)).toString();
}
1132247
function (filter) {
    var obj = {}
    var val = this.__input

    this.each(function (property, key) {
      obj[key] = property.flatten ? property.flatten(filter) : property
    }, wrapFilter(filter))

    if (val !== void 0) {
      if (val instanceof Base) {
        val = {
          reference: val.path
        }
      }
      obj.val = val
    }

    // refactoring non standard keys
    var flattened = flatten(obj)
    for (var key in flattened) {
      if (key.indexOf('.val') > 0) {
        var newKey = key.split('.val')[0]
        flattened[newKey] = flattened[key]
        delete flattened[key]
      }
    }
    return flattened
  }
580545
function/* 12.1.1.1 */$$core$$InitializeDateTimeFormat (dateTimeFormat, locales, options) {
        var
        // This will be a internal properties object if we're not already initialized
            internal = $$core$$getInternalProperties(dateTimeFormat),

        // Create an object whose props can be used to restore the values of RegExp props
            regexpState = $$core$$createRegExpRestore();

        // 1. If dateTimeFormat has an [[initializedIntlObject]] internal property with
        //    value true, throw a TypeError exception.
        if (internal['[[initializedIntlObject]]'] === true)
            throw new TypeError('`this` object has already been initialized as an Intl object');

        // Need this to access the `internal` object
        $$core$$defineProperty(dateTimeFormat, '__getInternalProperties', {
            value: function () {
                // NOTE: Non-standard, for internal use only
                if (arguments[0] === $$core$$secret)
                    return internal;
            }
        });

        // 2. Set the [[initializedIntlObject]] internal property of numberFormat to true.
        internal['[[initializedIntlObject]]'] = true;

        var
        // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList
        //    abstract operation (defined in 9.2.1) with argument locales.
            requestedLocales = $$core$$CanonicalizeLocaleList(locales),

        // 4. Let options be the result of calling the ToDateTimeOptions abstract
        //    operation (defined below) with arguments options, "any", and "date".
            options = $$core$$ToDateTimeOptions(options, 'any', 'date'),

        // 5. Let opt be a new Record.
            opt = new $$core$$Record();

        // 6. Let matcher be the result of calling the GetOption abstract operation
        //    (defined in 9.2.9) with arguments options, "localeMatcher", "string", a List
        //    containing the two String values "lookup" and "best fit", and "best fit".
            matcher = $$core$$GetOption(options, 'localeMatcher', 'string', new $$core$$List('lookup', 'best fit'), 'best fit');

        // 7. Set opt.[[localeMatcher]] to matcher.
        opt['[[localeMatcher]]'] = matcher;

        var
        // 8. Let DateTimeFormat be the standard built-in object that is the initial
        //    value of Intl.DateTimeFormat.
            DateTimeFormat = $$core$$internals.DateTimeFormat, // This is what we *really* need

        // 9. Let localeData be the value of the [[localeData]] internal property of
        //    DateTimeFormat.
            localeData = DateTimeFormat['[[localeData]]'],

        // 10. Let r be the result of calling the ResolveLocale abstract operation
        //     (defined in 9.2.5) with the [[availableLocales]] internal property of
        //      DateTimeFormat, requestedLocales, opt, the [[relevantExtensionKeys]]
        //      internal property of DateTimeFormat, and localeData.
            r = $$core$$ResolveLocale(DateTimeFormat['[[availableLocales]]'], requestedLocales,
                    opt, DateTimeFormat['[[relevantExtensionKeys]]'], localeData);

        // 11. Set the [[locale]] internal property of dateTimeFormat to the value of
        //     r.[[locale]].
        internal['[[locale]]'] = r['[[locale]]'];

        // 12. Set the [[calendar]] internal property of dateTimeFormat to the value of
        //     r.[[ca]].
        internal['[[calendar]]'] = r['[[ca]]'];

        // 13. Set the [[numberingSystem]] internal property of dateTimeFormat to the value of
        //     r.[[nu]].
        internal['[[numberingSystem]]'] = r['[[nu]]'];

        // The specification doesn't tell us to do this, but it's helpful later on
        internal['[[dataLocale]]'] = r['[[dataLocale]]'];

        var
        // 14. Let dataLocale be the value of r.[[dataLocale]].
            dataLocale = r['[[dataLocale]]'],

        // 15. Let tz be the result of calling the [[Get]] internal method of options with
        //     argument "timeZone".
            tz = options.timeZone;

        // 16. If tz is not undefined, then
        if (tz !== undefined) {
            // a. Let tz be ToString(tz).
            // b. Convert tz to upper case as described in 6.1.
            //    NOTE: If an implementation accepts additional time zone values, as permitted
            //          under certain conditions by the Conformance clause, different casing
            //          rules apply.
            tz = $$core$$toLatinUpperCase(tz);

            // c. If tz is not "UTC", then throw a RangeError exception.
            // ###TODO: accept more time zones###
            if (tz !== 'UTC')
                throw new RangeError('timeZone is not supported.');
        }

        // 17. Set the [[timeZone]] internal property of dateTimeFormat to tz.
        internal['[[timeZone]]'] = tz;

        // 18. Let opt be a new Record.
        opt = new $$core$$Record();

        // 19. For each row of Table 3, except the header row, do:
        for (var prop in $$core$$dateTimeComponents) {
            if (!$$core$$hop.call($$core$$dateTimeComponents, prop))
                continue;

            var
            // 20. Let prop be the name given in the Property column of the row.
            // 21. Let value be the result of calling the GetOption abstract operation,
            //     passing as argument options, the name given in the Property column of the
            //     row, "string", a List containing the strings given in the Values column of
            //     the row, and undefined.
                value = $$core$$GetOption(options, prop, 'string', $$core$$dateTimeComponents[prop]);

            // 22. Set opt.[[<prop>]] to value.
            opt['[['+prop+']]'] = value;
        }

        var
            // Assigned a value below
            bestFormat,

            // 23. Let dataLocaleData be the result of calling the [[Get]] internal method of
            //     localeData with argument dataLocale.
            dataLocaleData = localeData[dataLocale],

            // 24. Let formats be the result of calling the [[Get]] internal method of
            //     dataLocaleData with argument "formats".
            //     Note: we process the CLDR formats into the spec'd structure
            formats = $$core$$ToDateTimeFormats(dataLocaleData.formats),

            // 25. Let matcher be the result of calling the GetOption abstract operation with
            //     arguments options, "formatMatcher", "string", a List containing the two String
            //     values "basic" and "best fit", and "best fit".
            matcher = $$core$$GetOption(options, 'formatMatcher', 'string', new $$core$$List('basic', 'best fit'), 'best fit');

        // Optimization: caching the processed formats as a one time operation by
        // replacing the initial structure from localeData
        dataLocaleData.formats = formats;

        // 26. If matcher is "basic", then
        if (matcher === 'basic')
            // 27. Let bestFormat be the result of calling the BasicFormatMatcher abstract
            //     operation (defined below) with opt and formats.
            bestFormat = $$core$$BasicFormatMatcher(opt, formats);

        // 28. Else
        else
            // 29. Let bestFormat be the result of calling the BestFitFormatMatcher
            //     abstract operation (defined below) with opt and formats.
            bestFormat = $$core$$BestFitFormatMatcher(opt, formats);

        // 30. For each row in Table 3, except the header row, do
        for (var prop in $$core$$dateTimeComponents) {
            if (!$$core$$hop.call($$core$$dateTimeComponents, prop))
                continue;

            // a. Let prop be the name given in the Property column of the row.
            // b. Let pDesc be the result of calling the [[GetOwnProperty]] internal method of
            //    bestFormat with argument prop.
            // c. If pDesc is not undefined, then
            if ($$core$$hop.call(bestFormat, prop)) {
                var
                // i. Let p be the result of calling the [[Get]] internal method of bestFormat
                //    with argument prop.
                    p = bestFormat[prop];

                // ii. Set the [[<prop>]] internal property of dateTimeFormat to p.
                internal['[['+prop+']]'] = p;
            }
        }

        var
            // Assigned a value below
            pattern,

        // 31. Let hr12 be the result of calling the GetOption abstract operation with
        //     arguments options, "hour12", "boolean", undefined, and undefined.
            hr12 = $$core$$GetOption(options, 'hour12', 'boolean'/*, undefined, undefined*/);

        // 32. If dateTimeFormat has an internal property [[hour]], then
        if (internal['[[hour]]']) {
            // a. If hr12 is undefined, then let hr12 be the result of calling the [[Get]]
            //    internal method of dataLocaleData with argument "hour12".
            hr12 = hr12 === undefined ? dataLocaleData.hour12 : hr12;

            // b. Set the [[hour12]] internal property of dateTimeFormat to hr12.
            internal['[[hour12]]'] = hr12;

            // c. If hr12 is true, then
            if (hr12 === true) {
                var
                // i. Let hourNo0 be the result of calling the [[Get]] internal method of
                //    dataLocaleData with argument "hourNo0".
                    hourNo0 = dataLocaleData.hourNo0;

                // ii. Set the [[hourNo0]] internal property of dateTimeFormat to hourNo0.
                internal['[[hourNo0]]'] = hourNo0;

                // iii. Let pattern be the result of calling the [[Get]] internal method of
                //      bestFormat with argument "pattern12".
                pattern = bestFormat.pattern12;
            }

            // d. Else
            else
                // i. Let pattern be the result of calling the [[Get]] internal method of
                //    bestFormat with argument "pattern".
                pattern = bestFormat.pattern;
        }

        // 33. Else
        else
            // a. Let pattern be the result of calling the [[Get]] internal method of
            //    bestFormat with argument "pattern".
            pattern = bestFormat.pattern;

        // 34. Set the [[pattern]] internal property of dateTimeFormat to pattern.
        internal['[[pattern]]'] = pattern;

        // 35. Set the [[boundFormat]] internal property of dateTimeFormat to undefined.
        internal['[[boundFormat]]'] = undefined;

        // 36. Set the [[initializedDateTimeFormat]] internal property of dateTimeFormat to
        //     true.
        internal['[[initializedDateTimeFormat]]'] = true;

        // In ES3, we need to pre-bind the format() function
        if ($$core$$es3)
            dateTimeFormat.format = $$core$$GetFormatDateTime.call(dateTimeFormat);

        // Restore the RegExp properties
        regexpState.exp.test(regexpState.input);

        // Return the newly initialised object
        return dateTimeFormat;
    }
628042
private void fixFunctionType(Node functionNode) {
    JSType t = functionNode.getJSType();
    if (t == null) {
      return;
    }
    FunctionType ft = t.toMaybeFunctionType();
    if (ft != null) {
      functionNode.setJSType(convertMethodToFunction(ft));
    }
  }
774241
def method_missing(m, *args, &block)
      if m.to_s =~ /^with_(.+)$/
        with($1.to_sym => args.first)
        self
      else
        super
      end
    end
364624
@Override
  /*!#if ($TemplateOptions.KTypePrimitive)
  public KType [] toArray()
     #else !*/
  public Object[] toArray()
  /*! #end !*/
  {
    KType[] array = Intrinsics.<KType> newArray(size());
    int i = 0;
    for (KTypeCursor<KType> c : this) {
      array[i++] = c.value;
    }
    return array;
  }
1068577
function () {
			/** A stateful object to hold items till they are added to the compiler */
			var pkg = {
				exec          : [],
				aliases       : {},
				dependAliases : [],
				ignore        : [],
				publish       : [],
				externals     : [],
				modules       : [],
				noParse       : []
			};

			// process modules to ignore
			var ignore = task.data.ignore;
			if ( !sys.isEmpty( ignore ) && !sys.isEmpty( ignore.src ) ) {
				grunt.verbose.writeln( "Adding ignores" );

				pkg.ignore = sys.map( grunt.file.expand( ignore, ignore.src ), function ( item ) {
					return resolvePath( item );
				} );
			}

			// process modules that won't be parsed
			var noParse = task.data.noParse;
			if ( !sys.isEmpty( noParse ) && !sys.isEmpty( noParse.src ) ) {
				grunt.verbose.writeln( "Adding ignores" );

				pkg.noParse = sys.map( grunt.file.expand( noParse, noParse.src ), function ( item ) {
					return resolvePath( item );
				} );
			}

			// process executable modules
			var exec = task.data.exec;
			if ( !sys.isEmpty( exec ) && !sys.isEmpty( exec.src ) ) {
				grunt.verbose.writeln( "Adding executable modules" );

				pkg.exec = sys.map( grunt.file.expand( exec, exec.src ), function ( item ) {
					return resolvePath( item );
				} );
			}

			// process module entries
			var modules = task.data.modules;
			if ( !sys.isEmpty( modules ) && !sys.isEmpty( modules.src ) ) {
				grunt.verbose.writeln( "Adding modules" );

				pkg.modules = sys.map( grunt.file.expand( modules, modules.src ), function ( item ) {
					return resolvePath( item );
				} );
			}

			// process modules to be published
			var publish = task.data.publish;
			if ( !sys.isEmpty( publish ) && !sys.isEmpty( publish.src ) ) {
				grunt.verbose.writeln( "Adding published modules" );

				pkg.publish = sys.map( grunt.file.expand( publish, publish.src ), function ( item ) {
					return resolvePath( item );
				} );
			}

			// process externals entries
			var externals = task.data.externals;
			if ( !sys.isEmpty( externals ) && !sys.isEmpty( externals.src ) ) {
				grunt.log.writeln( "Adding external modules" );

				pkg.externals = sys.map( grunt.file.expand( externals, externals.src ), function ( item ) {
					return resolvePath( item );
				} );
			}

			// get all task aliases
			sys.extend( pkg.aliases, getTaskAliases( task.target, options ) );
			if ( !sys.isEmpty( task.data.depends ) ) {
				sys.each( task.data.depends, function ( depends ) {
					var dependents = getTaskAliases( depends, options );

					sys.each( dependents, function ( val, key ) {
						pkg.dependAliases.push( key );
					} );
				} );
			}

			// get dependencies definitions and add them to this as external
			if ( options.autoExternals && !sys.isEmpty( task.data.depends ) ) {
				sys.each( task.data.depends, function ( depends ) {
					pkg.externals = pkg.externals.concat( getTaskSources( depends ) );
				} );
			}

			return pkg;
		}
47452
private void maybeUpdateExportObjectLiteral(NodeTraversal t, Node n) {
    if (!currentScript.isModule) {
      return;
    }

    Node parent = n.getParent();
    Node rhs = parent.getLastChild();

    if (rhs.isObjectLit()) {
      for (Node c = rhs.getFirstChild(); c != null; c = c.getNext()) {
        if (c.isComputedProp()) {
          t.report(c, INVALID_EXPORT_COMPUTED_PROPERTY);
        } else if (c.isStringKey()) {
          if (!c.hasChildren()) {
            c.addChildToBack(IR.name(c.getString()).useSourceInfoFrom(c));
          }
          Node value = c.getFirstChild();
          maybeUpdateExportDeclToNode(t, c, value);
        }
      }
    }
  }
1344651
def refactor_use_function(self, offset):
        """"""
        try:
            refactor = UseFunction(self.project, self.resource, offset)
        except RefactoringError as e:
            raise Fault(
                'Refactoring error: {}'.format(e),
                code=400
            )
        return self._get_changes(refactor)
8535
def refactor(self, items, write=False, doctests_only=False):
        """"""

        for dir_or_file in items:
            if os.path.isdir(dir_or_file):
                self.refactor_dir(dir_or_file, write, doctests_only)
            else:
                self.refactor_file(dir_or_file, write, doctests_only)
1110733
function init() {
        CodeMirror.defineOption("foldGutter", false, function (cm, val, old) {
            if (old && old !== CodeMirror.Init) {
                cm.clearGutter(cm.state.foldGutter.options.gutter);
                cm.state.foldGutter = null;
                cm.off("gutterClick", old.onGutterClick);
                cm.off("change", onChange);
                cm.off("viewportChange", onViewportChange);
                cm.off("cursorActivity", onCursorActivity);

                cm.off("fold", onFold);
                cm.off("unfold", onUnFold);
                cm.off("swapDoc", updateInViewport);
            }
            if (val) {
                cm.state.foldGutter = new State(parseOptions(val));
                updateInViewport(cm);
                cm.on("gutterClick", val.onGutterClick);
                cm.on("change", onChange);
                cm.on("viewportChange", onViewportChange);
                cm.on("cursorActivity", onCursorActivity);
                cm.on("fold", onFold);
                cm.on("unfold", onUnFold);
                cm.on("swapDoc", updateInViewport);
            }
        });
    }