text:
@implementation NSImage (LCSCocoaKit)

- (NSImage*)resizeTo:(CGSize)newSize
{
    if (!self.isValid) {
        return nil;
    }

    NSImage *smallImage = [[NSImage alloc] initWithSize:newSize];
    [smallImage lockFocus];
    self.size = newSize;
    [NSGraphicsContext currentContext].imageInterpolation = NSImageInterpolationHigh;
    [self drawAtPoint:NSZeroPoint fromRect:CGRectMake(0, 0, newSize.width, newSize.height) operation:NSCompositeCopy fraction:1.0];
    [smallImage unlockFocus];
    return smallImage;
}

- (NSImage *)imageTintedWithColor:(NSColor *)tint
{
    NSImage *image = [self copy];
    if (tint) {
        [image lockFocus];
        [tint set];
        NSRect imageRect = {NSZeroPoint, image.size};
        NSRectFillUsingOperation(imageRect, NSCompositeSourceAtop);
        [image unlockFocus];
    }
    return image;
}

- (BOOL)writePngToUrl:(NSURL*)url error:(NSError *__autoreleasing *)error
{
    CGImageRef cgRef = [self CGImageForProposedRect:NULL
                                            context:nil
                                              hints:nil];
    NSBitmapImageRep *newRep = [[NSBitmapImageRep alloc] initWithCGImage:cgRef];
    newRep.size = self.size;
    NSData *pngData = [newRep representationUsingType:NSPNGFileType properties:@{}];

    return [pngData writeToURL:url options:NSDataWritingAtomic error:error];
}

@end

redpajama_set_name: RedPajamaGithub


text:
package resources

import "github.com/awslabs/goformation/cloudformation/policies"

// AWSEC2EC2Fleet_TargetCapacitySpecificationRequest AWS CloudFormation Resource (AWS::EC2::EC2Fleet.TargetCapacitySpecificationRequest)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-targetcapacityspecificationrequest.html
type AWSEC2EC2Fleet_TargetCapacitySpecificationRequest struct {

	// DefaultTargetCapacityType AWS CloudFormation Property
	// Required: false
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-targetcapacityspecificationrequest.html#cfn-ec2-ec2fleet-targetcapacityspecificationrequest-defaulttargetcapacitytype
	DefaultTargetCapacityType string `json:"DefaultTargetCapacityType,omitempty"`

	// OnDemandTargetCapacity AWS CloudFormation Property
	// Required: false
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-targetcapacityspecificationrequest.html#cfn-ec2-ec2fleet-targetcapacityspecificationrequest-ondemandtargetcapacity
	OnDemandTargetCapacity int `json:"OnDemandTargetCapacity,omitempty"`

	// SpotTargetCapacity AWS CloudFormation Property
	// Required: false
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-targetcapacityspecificationrequest.html#cfn-ec2-ec2fleet-targetcapacityspecificationrequest-spottargetcapacity
	SpotTargetCapacity int `json:"SpotTargetCapacity,omitempty"`

	// TotalTargetCapacity AWS CloudFormation Property
	// Required: true
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-targetcapacityspecificationrequest.html#cfn-ec2-ec2fleet-targetcapacityspecificationrequest-totaltargetcapacity
	TotalTargetCapacity int `json:"TotalTargetCapacity"`

	// _deletionPolicy represents a CloudFormation DeletionPolicy
	_deletionPolicy policies.DeletionPolicy

	// _dependsOn stores the logical ID of the resources to be created before this resource
	_dependsOn []string

	// _metadata stores structured data associated with this resource
	_metadata map[string]interface{}
}

// AWSCloudFormationType returns the AWS CloudFormation resource type
func (r *AWSEC2EC2Fleet_TargetCapacitySpecificationRequest) AWSCloudFormationType() string {
	return "AWS::EC2::EC2Fleet.TargetCapacitySpecificationRequest"
}

// DependsOn returns a slice of logical ID names this resource depends on.
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-dependson.html
func (r *AWSEC2EC2Fleet_TargetCapacitySpecificationRequest) DependsOn() []string {
	return r._dependsOn
}

// SetDependsOn specify that the creation of this resource follows another.
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-dependson.html
func (r *AWSEC2EC2Fleet_TargetCapacitySpecificationRequest) SetDependsOn(dependencies []string) {
	r._dependsOn = dependencies
}

// Metadata returns the metadata associated with this resource.
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-metadata.html
func (r *AWSEC2EC2Fleet_TargetCapacitySpecificationRequest) Metadata() map[string]interface{} {
	return r._metadata
}

// SetMetadata enables you to associate structured data with this resource.
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-metadata.html
func (r *AWSEC2EC2Fleet_TargetCapacitySpecificationRequest) SetMetadata(metadata map[string]interface{}) {
	r._metadata = metadata
}

// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html
func (r *AWSEC2EC2Fleet_TargetCapacitySpecificationRequest) SetDeletionPolicy(policy policies.DeletionPolicy) {
	r._deletionPolicy = policy
}


text:
var StringSplosion = require('../app/StringSplosion');

describe(" String splosion", function() {

    it("should manipulate the string", function() {
        var stringSplosion = new StringSplosion("Code");
        expect(stringSplosion.manipulate()).toEqual("CCoCodCode");
    });

    it("should manipulate the string not return the expected result, 1.", function() {
        var stringSplosion = new StringSplosion("Code");
        var functionString = stringSplosion.manipulate.toString();
        expect(stringSplosion.manipulate()).toEqual("CCoCodCode");
        expect(functionString.indexOf('CCoCodCode')).toBe(-1);
    });

    it("should manipulate a second time", function() {
        var stringSplosion = new StringSplosion("abc");
        expect(stringSplosion.manipulate()).toEqual("aababc");
    });

    it("should manipulate a third time", function() {
        var stringSplosion = new StringSplosion("andela");
        var functionString = stringSplosion.manipulate.toString();
        expect(stringSplosion.manipulate()).toEqual("aanandandeandelandela");
    });

    it("should manipulate the string not return the expected result, 2.", function() {
        var stringSplosion = new StringSplosion("andela");
        var functionString = stringSplosion.manipulate.toString();
        expect(stringSplosion.manipulate()).toEqual("aanandandeandelandela");
        expect(functionString.indexOf('aanandandeandelandela')).toBe(-1);
    });
});


text:
        <?= $this->render('//product/_filter_ajax', ['existIds' => $existIds]); ?>

    <form id="form-with-found-products-ajax" method="get" action="<?= $actionName ?>">
        <input type="hidden" name="product_id" value="<?= $product_id ?>" />
        <?php if (isset($variable)): ?>
            <input type="hidden" name="variable" value="<?= $variable ?>" />
        <?php endif; ?>

    </form>


text:
package com.google.javascript.jscomp;

import static com.google.common.truth.Truth.assertThat;

import com.google.javascript.jscomp.DisambiguateProperties.Warnings;
import com.google.javascript.rhino.Node;
import java.util.HashMap;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
 * Unit test for AmbiguateProperties Compiler pass.
 *
 */

@RunWith(JUnit4.class)
public final class AmbiguatePropertiesTest extends CompilerTestCase {
  private AmbiguateProperties lastPass;

  private static final String EXTERNS = lines(
      MINIMAL_EXTERNS,
      "Function.prototype.call=function(){};",
      "Function.prototype.inherits=function(){};",
      "Object.defineProperties = function(typeRef, definitions) {};",
      "Object.prototype.toString = function() {};",
      "var google = { gears: { factory: {}, workerPool: {} } };",
      "/** @return {?} */ function any() {};",
      "/** @constructor */ function Window() {}",
      "/** @const */ var window = {};");

  public AmbiguatePropertiesTest() {
    super(EXTERNS);
  }

  @Override
  @Before
  public void setUp() throws Exception {
    super.setUp();
    enableTypeCheck();
    enableNormalize();
    enableClosurePass();
    enableGatherExternProperties();
  }

  @Override
  protected CompilerPass getProcessor(final Compiler compiler) {
    return new CompilerPass() {
      @Override
      public void process(Node externs, Node root) {
        lastPass =
            AmbiguateProperties.makePassForTesting(compiler, new char[] {'$'}, new char[] {'$'});
        lastPass.process(externs, root);
      }
    };
  }

  @Override
  protected int getNumRepetitions() {
    return 1;
  }

  @Test
  public void testOneVar1() {
    test("/** @constructor */ var Foo = function(){};Foo.prototype.b = 0;",
         "/** @constructor */ var Foo = function(){};Foo.prototype.a = 0;");
  }

  @Test
  public void testOneVar2() {
    test(lines(
            "/** @constructor */ var Foo = function(){};",
            "Foo.prototype = {b: 0};"),
        lines(
            "/** @constructor */ var Foo = function(){};",
            "Foo.prototype = {a: 0};"));
  }

  @Test
  public void testOneVar3() {
    test(
        lines(
            "/** @constructor */ var Foo = function(){};",
            "Foo.prototype = {get b() {return 0}};"),
        lines(
            "/** @constructor */ var Foo = function(){};",
            "Foo.prototype = {get a() {return 0}};"));
  }

  @Test
  public void testOneVar4() {
    test(
        lines(
            "/** @constructor */ var Foo = function(){};",
            "Foo.prototype = {set b(a) {}};"),
        lines(
            "/** @constructor */ var Foo = function(){};",
            "Foo.prototype = {set a(a) {}};"));
  }

  @Test
  public void testTwoVar1() {
    String js = lines(
        "/** @constructor */ var Foo = function(){};",
        "Foo.prototype.z=0;",
        "Foo.prototype.z=0;",
        "Foo.prototype.x=0;");
    String output = lines(
        "/** @constructor */ var Foo = function(){};",
        "Foo.prototype.a=0;",
        "Foo.prototype.a=0;",
        "Foo.prototype.b=0;");
    test(js, output);
  }

  @Test
  public void testTwoVar2() {
    String js = lines(
        "/** @constructor */ var Foo = function(){};",
        "Foo.prototype = {z:0, z:1, x:0};");
    String output = lines(
        "/** @constructor */ var Foo = function(){};",
        "Foo.prototype = {a:0, a:1, b:0};");
    test(js, output);
  }

  @Test
  public void testTwoIndependentVar() {
    String js = lines(
        "/** @constructor */ var Foo = function(){};",
        "Foo.prototype.b = 0;",
        "/** @constructor */ var Bar = function(){};",
        "Bar.prototype.c = 0;");
    String output = lines(
        "/** @constructor */ var Foo = function(){};",
        "Foo.prototype.a=0;",
        "/** @constructor */ var Bar = function(){};",
        "Bar.prototype.a=0;");
    test(js, output);
  }

  @Test
  public void testTwoTypesTwoVar() {
    String js = lines(
        "/** @constructor */ var Foo = function(){};",
        "Foo.prototype.r = 0;",
        "Foo.prototype.g = 0;",
        "/** @constructor */ var Bar = function(){};",
        "Bar.prototype.c = 0;",
        "Bar.prototype.r = 0;");
    String output = lines(
        "/** @constructor */ var Foo = function(){};",
        "Foo.prototype.a=0;",
        "Foo.prototype.b=0;",
        "/** @constructor */ var Bar = function(){};",
        "Bar.prototype.b=0;",
        "Bar.prototype.a=0;");
    test(js, output);
  }

  @Test
  public void testUnion_withUnrelatedPropertyAccess() {
    String js =
        lines(
            "/** @constructor */ var Foo = function(){};",
            "/** @constructor */ var Bar = function(){};",
            "Foo.prototype.foodoo=0;",
            "Bar.prototype.bardoo=0;",
            // variable exists that could be a Foo or a Bar
            "/** @type {Foo|Bar} */",
            "var U = any();",
            // We don't actually access either foodoo or bardoo on it,
            // though, so it's OK if they end up having the same name
            "U.joint");
    String output =
        lines(
            "/** @constructor */ var Foo = function(){};",
            "/** @constructor */ var Bar = function(){};",
            "Foo.prototype.a=0;",
            "Bar.prototype.a=0;",
            "/** @type {Foo|Bar} */",
            "var U = any();",
            "U.b");
    test(js, output);
  }

  @Test
  public void testUnion_withRelatedPropertyAccess() {
    String js =
        lines(
            "/** @constructor */ var Foo = function(){};",
            "/** @constructor */ var Bar = function(){};",
            "Foo.prototype.foodoo=0;",
            "Bar.prototype.bardoo=0;",
            // variable exists that could be a Foo or a Bar
            "/** @type {Foo|Bar} */",
            "var U = any();",
            // both foodoo and bardoo are accessed through that variable,
            // so they must have different names.
            "U.foodoo;",
            "U.bardoo");
    String output =
        lines(
            "/** @constructor */ var Foo = function(){};",
            "/** @constructor */ var Bar = function(){};",
            "Foo.prototype.b=0;",
            "Bar.prototype.a=0;",
            "/** @type {Foo|Bar} */",
            "var U = any();",
            "U.b;",
            "U.a");
    test(js, output);
  }

  @Test
  public void testUnions() {
    String js = lines(
        "/** @constructor */ var Foo = function(){};",
        "/** @constructor */ var Bar = function(){};",
        "/** @constructor */ var Baz = function(){};",
        "/** @constructor */ var Bat = function(){};",
        "Foo.prototype.lone1=0;",
        "Bar.prototype.lone2=0;",
        "Baz.prototype.lone3=0;",
        "Bat.prototype.lone4=0;",
        "/** @type {Foo|Bar} */",
        "var U1 = any();",
        "U1.j1;",
        "U1.j2;",
        "/** @type {Baz|Bar} */",
        "var U2 = any();",
        "U2.j3;",
        "U2.j4;",
        "/** @type {Baz|Bat} */",
        "var U3 = any();",
        "U3.j5;",
        "U3.j6");
    String output = lines(
        "/** @constructor */ var Foo = function(){};",
        "/** @constructor */ var Bar = function(){};",
        "/** @constructor */ var Baz = function(){};",
        "/** @constructor */ var Bat = function(){};",
        "Foo.prototype.c=0;",
        "Bar.prototype.e=0;",
        "Baz.prototype.e=0;",
        "Bat.prototype.c=0;",
        "/** @type {Foo|Bar} */",
        "var U1 = any();",
        "U1.a;",
        "U1.b;",
        "/** @type {Baz|Bar} */",
        "var U2 = any();",
        "U2.c;",
        "U2.d;",
        "/** @type {Baz|Bat} */",
        "var U3 = any();",
        "U3.a;",
        "U3.b");
    test(js, output);
  }

  @Test
  public void testExtends() {
    String js = lines(
        "/** @constructor */ var Foo = function(){};",
        "Foo.prototype.x=0;",
        "/** @constructor \n @extends Foo */ var Bar = function(){};",
        "goog.inherits(Bar, Foo);",
        "Bar.prototype.y=0;",
        "Bar.prototype.z=0;",
        "/** @constructor */ var Baz = function(){};",
        "Baz.prototype.l=0;",
        "Baz.prototype.m=0;",
        "Baz.prototype.n=0;",
        "(new Baz).m\n");
    String output = lines(
        "/** @constructor */ var Foo = function(){};",
        "Foo.prototype.a=0;",
        "/** @constructor \n @extends Foo */ var Bar = function(){};",
        "goog.inherits(Bar, Foo);",
        "Bar.prototype.b=0;",
        "Bar.prototype.c=0;",
        "/** @constructor */ var Baz = function(){};",
        "Baz.prototype.b=0;",
        "Baz.prototype.a=0;",
        "Baz.prototype.c=0;",
        "(new Baz).a\n");
    test(js, output);
  }

  @Test
  public void testLotsOfVars() {
    StringBuilder js = new StringBuilder();
    StringBuilder output = new StringBuilder();
    js.append("/** @constructor */ var Foo = function(){};\n");
    js.append("/** @constructor */ var Bar = function(){};\n");
    output.append(js);

    int vars = 10;
    for (int i = 0; i < vars; i++) {
      js.append("Foo.prototype.var").append(i).append(" = 0;");
      js.append("Bar.prototype.var").append(i + 10000).append(" = 0;");
      output.append("Foo.prototype.").append((char) ('a' + i)).append("=0;");
      output.append("Bar.prototype.").append((char) ('a' + i)).append("=0;");
    }
    test(js.toString(), output.toString());
  }

  @Test
  public void testLotsOfClasses() {
    StringBuilder b = new StringBuilder();
    int classes = 10;
    for (int i = 0; i < classes; i++) {
      String c = "Foo" + i;
      b.append("/** @constructor */ var ").append(c).append(" = function(){};\n");
      b.append(c).append(".prototype.varness").append(i).append(" = 0;");
    }
    String js = b.toString();
    test(js, js.replaceAll("varness\\d+", "a"));
  }

  @Test
  public void testFunctionType() {
    String js = lines(
        "/** @constructor */ function Foo(){};",
        "/** @return {Bar} */",
        "Foo.prototype.fun = function() { return new Bar(); };",
        "/** @constructor */ function Bar(){};",
        "Bar.prototype.bazz;",
        "(new Foo).fun().bazz();");
    String output = lines(
        "/** @constructor */ function Foo(){};",
        "/** @return {Bar} */",
        "Foo.prototype.a = function() { return new Bar(); };",
        "/** @constructor */ function Bar(){};",
        "Bar.prototype.a;",
        "(new Foo).a().a();");
    test(js, output);
  }

  @Test
  public void testPrototypePropertiesAsObjLitKeys1() {
    test("/** @constructor */ function Bar() {};" +
             "Bar.prototype = {2: function(){}, getA: function(){}};",
             "/** @constructor */ function Bar() {};" +
             "Bar.prototype = {2: function(){}, a: function(){}};");
  }

  @Test
  public void testPrototypePropertiesAsObjLitKeys2() {
    testSame("/** @constructor */ function Bar() {};" +
             "Bar.prototype = {2: function(){}, 'getA': function(){}};");
  }

  @Test
  public void testQuotedPrototypeProperty() {
    testSame("/** @constructor */ function Bar() {};" +
             "Bar.prototype['getA'] = function(){};" +
             "var bar = new Bar();" +
             "bar['getA']();");
  }

  @Test
  public void testObjectDefineProperties() {
    String js =
        lines(
            "/** @constructor */ var Bar = function(){};",
            "Bar.prototype.bar = 0;",
            "/** @struct @constructor */ var Foo = function() {",
            "  this.bar_ = 'bar';",
            "};",
            "/** @type {?} */ Foo.prototype.bar;",
            "Object.defineProperties(Foo.prototype, {",
            "  bar: {",
            "    configurable: true,",
            "    enumerable: true,",
            "    /** @this {Foo} */ get: function() { return this.bar_;},",
            "    /** @this {Foo} */ set: function(value) { this.bar_ = value; }",
            "  }",
            "});");

    String result =
        lines(
            "/** @constructor */ var Bar = function(){};",
            "Bar.prototype.a = 0;",
            "/** @struct @constructor */ var Foo = function() {",
            "  this.b = 'bar';",
            "};",
            "/** @type {?} */ Foo.prototype.a;",
            "Object.defineProperties(Foo.prototype, {",
            "  a: {",
            "    configurable: true,",
            "    enumerable: true,",
            "    /** @this {Foo} */ get: function() { return this.b;},",
            "    /** @this {Foo} */ set: function(value) { this.b = value; }",
            "  }",
            "});");

    test(js, result);
  }

  @Test
  public void testObjectDefinePropertiesQuoted() {
    String js =
        lines(
            "/** @constructor */ var Bar = function(){};",
            "Bar.prototype.bar = 0;",
            "/** @struct @constructor */ var Foo = function() {",
            "  this.bar_ = 'bar';",
            "};",
            "/** @type {?} */ Foo.prototype['bar'];",
            "Object.defineProperties(Foo.prototype, {",
            "  'a': {",
            "    configurable: true,",
            "    enumerable: true,",
            "    /** @this {Foo} */ get: function() { return this.bar_;},",
            "    /** @this {Foo} */ set: function(value) { this.bar_ = value; }",
            "  }",
            "});");

    String result =
        lines(
            "/** @constructor */ var Bar = function(){};",
            "Bar.prototype.b = 0;",
            "/** @struct @constructor */ var Foo = function() {",
            "  this.b = 'bar';",
            "};",
            "/** @type {?} */ Foo.prototype['bar'];",
            "Object.defineProperties(Foo.prototype, {",
            "  'a': {",
            "    configurable: true,",
            "    enumerable: true,",
            "    /** @this {Foo} */ get: function() { return this.b;},",
            "    /** @this {Foo} */ set: function(value) { this.b = value; }",
            "  }",
            "});");

    test(js, result);
  }

  @Test
  public void testOverlappingOriginalAndGeneratedNames() {
    test(
        lines(
            "/** @constructor */ function Bar(){};",
            "Bar.prototype.b = function(){};",
            "Bar.prototype.a = function(){};",
            "var bar = new Bar();",
            "bar.b();"),
        lines(
            "/** @constructor */ function Bar(){};",
            "Bar.prototype.a = function(){};",
            "Bar.prototype.b = function(){};",
            "var bar = new Bar();",
            "bar.a();"));
  }

  @Test
  public void testPropertyAddedToObject() {
    testSame("var foo = {}; foo.prop = '';");
  }

  @Test
  public void testPropertyAddedToFunction() {
    test("var foo = function(){}; foo.prop = '';",
         "var foo = function(){}; foo.a = '';");
  }

  @Test
  public void testPropertyAddedToFunctionIndirectly() {
    test(
        lines(
            "var foo = function(){}; foo.prop = ''; foo.baz = '';",
            "function f(/** function(): void */ fun) { fun.bar = ''; fun.baz = ''; }"),
        lines(
            "var foo = function(){}; foo.a = ''; foo.baz = '';",
            "function f(/** function(): void */ fun) { fun.bar = ''; fun.baz = ''; }"));
  }

  @Test
  public void testPropertyOfObjectOfUnknownType() {
    testSame("var foo = x(); foo.prop = '';");
  }

  @Test
  public void testPropertyOnParamOfUnknownType() {
    testSame(
        lines(
            "/** @constructor */ function Foo(){};",
             "Foo.prototype.prop = 0;",
             "function go(aFoo){",
             "  aFoo.prop = 1;",
             "}"));
  }

  @Test
  public void testSetPropertyOfGlobalThis() {
    test("this.prop = 'bar'", "this.a = 'bar'");
  }

  @Test
  public void testReadPropertyOfGlobalThis() {
    testSame(externs(EXTERNS + "Object.prototype.prop;"), srcs("f(this.prop);"));
  }

  @Test
  public void testSetQuotedPropertyOfThis() {
    testSame("this['prop'] = 'bar';");
  }

  @Test
  public void testExternedPropertyName() {
    test(
        lines(
            "/** @constructor */ var Bar = function(){};",
            "/** @override */ Bar.prototype.toString = function(){};",
            "Bar.prototype.func = function(){};",
            "var bar = new Bar();",
            "bar.toString();"),
        lines(
            "/** @constructor */ var Bar = function(){};",
            "/** @override */ Bar.prototype.toString = function(){};",
            "Bar.prototype.a = function(){};",
            "var bar = new Bar();",
            "bar.toString();"));
  }

  @Test
  public void testExternedPropertyNameDefinedByObjectLiteral() {
    testSame("/**@constructor*/function Bar(){};Bar.prototype.factory");
  }

  @Test
  public void testStaticAndInstanceMethodWithSameName() {
    test("/** @constructor */function Bar(){}; Bar.getA = function(){}; " +
         "Bar.prototype.getA = function(){}; Bar.getA();" +
         "var bar = new Bar(); bar.getA();",
         "/** @constructor */function Bar(){}; Bar.a = function(){};" +
         "Bar.prototype.a = function(){}; Bar.a();" +
         "var bar = new Bar(); bar.a();");
  }

  @Test
  public void testStaticAndInstanceProperties() {
    test("/** @constructor */function Bar(){};" +
         "Bar.getA = function(){}; " +
         "Bar.prototype.getB = function(){};",
         "/** @constructor */function Bar(){}; Bar.a = function(){};" +
         "Bar.prototype.a = function(){};");
  }

  @Test
  public void testStaticAndSubInstanceProperties() {
    String js = lines(
        "/** @constructor */ var Foo = function(){};",
        "Foo.x=0;",
        "/** @constructor \n @extends Foo */ var Bar = function(){};",
        "goog.inherits(Bar, Foo);",
        "Bar.y=0;",
        "Bar.prototype.z=0;\n");
    String output = lines(
        "/** @constructor */ var Foo = function(){};",
        "Foo.a=0;",
        "/** @constructor \n @extends Foo */ var Bar = function(){};",
        "goog.inherits(Bar, Foo);",
        "Bar.a=0;",
        "Bar.prototype.a=0;\n");
    test(js, output);
  }

  @Test
  public void testStatic() {
    String js = lines(
      "/** @constructor */ var Foo = function() {};",
      "Foo.x = 0;",
      "/** @constructor */ var Bar = function() {};",
      "Bar.y = 0;");

    String output = lines(
      "/** @constructor */ var Foo = function() {};",
      "Foo.a = 0;",
      "/** @constructor */ var Bar = function() {};",
      "Bar.a = 0;");
    test(js, output);
  }

  @Test
  public void testClassWithStaticsPassedToUnrelatedFunction() {
    String js = lines(
      "/** @constructor */ var Foo = function() {};",
      "Foo.x = 0;",
      "/** @param {!Function} x */ function f(x) { x.y = 1; x.z = 2; }",
      "f(Foo)");
    String output = lines(
      "/** @constructor */ var Foo = function() {};",
      "Foo.a = 0;",
      "/** @param {!Function} x */ function f(x) { x.y = 1; x.z = 2; }",
      "f(Foo)");
    test(js, output);
  }

  @Test
  public void testClassWithStaticsPassedToRelatedFunction() {
    String js = lines(
      "/** @constructor */ var Foo = function() {};",
      "Foo.x = 0;",
      "/** @param {!Function} x */ function f(x) { x.y = 1; x.x = 2;}",
      "f(Foo)");
    testSame(js);
  }

  @Test
  public void testTypeMismatch() {
    ignoreWarnings(
        TypeValidator.TYPE_MISMATCH_WARNING);
    testSame(lines(
        "/** @constructor */var Foo = function(){};",
        "/** @constructor */var Bar = function(){};",
        "Foo.prototype.b = 0;",
        "/** @type {Foo} */",
        "var F = new Bar();"));
  }

  @Test
  public void testRenamingMap() {
    String js = lines(
        "/** @constructor */ var Foo = function(){};",
        "Foo.prototype.z=0;",
        "Foo.prototype.z=0;",
        "Foo.prototype.x=0;",
        "Foo.prototype.y=0;");
    String output = lines(
        "/** @constructor */ var Foo = function(){};",
        "Foo.prototype.a=0;",
        "Foo.prototype.a=0;",
        "Foo.prototype.b=0;",
        "Foo.prototype.c=0;");
    test(js, output);

    Map<String, String> answerMap = new HashMap<>();
    answerMap.put("x", "b");
    answerMap.put("y", "c");
    answerMap.put("z", "a");
    assertThat(lastPass.getRenamingMap()).isEqualTo(answerMap);
  }

  @Test
  public void testInline() {
    String js = lines(
        "/** @interface */ function Foo(){}",
        "Foo.prototype.x = function(){};",
        "/**",
        " * @constructor",
        " * @implements {Foo}",
        " */",
        "function Bar(){}",
        "Bar.prototype.y;",
        "/** @override */",
        "Bar.prototype.x = function() { return this.y; };",
        "Bar.prototype.z = function() {};\n"
        // Simulates inline getters.
        + "/** @type {Foo} */ (new Bar).y;");
    String output = lines(
        "/** @interface */ function Foo(){}",
        "Foo.prototype.b = function(){};",
        "/**",
        " * @constructor",
        " * @implements {Foo}",
        " */",
        "function Bar(){}",
        "Bar.prototype.a;",
        "/** @override */",
        "Bar.prototype.b = function() { return this.a; };",
        "Bar.prototype.c = function() {};\n"
        // Simulates inline getters.
        + "(new Bar).a;");
    test(js, output);
  }

  @Test
  public void testImplementsAndExtends() {
    String js = lines(
        "/** @interface */ function Foo() {}",
        "/** @constructor */ function Bar(){}",
        "Bar.prototype.y = function() { return 3; };",
        "/**",
        " * @constructor",
        " * @extends {Bar}",
        " * @implements {Foo}",
        " */",
        "function SubBar(){ }",
        "/** @param {Foo} x */ function f(x) { x.z = 3; }",
        "/** @param {SubBar} x */ function g(x) { x.z = 3; }");
    String output = lines(
        "/** @interface */ function Foo(){}",
        "/** @constructor */ function Bar(){}",
        "Bar.prototype.b = function() { return 3; };",
        "/**",
        " * @constructor",
        " * @extends {Bar}",
        " * @implements {Foo}",
        " */",
        "function SubBar(){}",
        "/** @param {Foo} x */ function f(x) { x.a = 3; }",
        "/** @param {SubBar} x */ function g(x) { x.a = 3; }");
    test(js, output);
  }

  @Test
  public void testImplementsAndExtends2() {
    String js = lines(
        "/** @interface */ function A() {}",
        "/**",
        " * @constructor",
        " */",
        "function C1(){}",
        "/**",
        " * @constructor",
        " * @extends {C1}",
        " * @implements {A}",
        " */",
        "function C2(){}",
        "/** @param {C1} x */ function f(x) { x.y = 3; }",
        "/** @param {A} x */ function g(x) { x.z = 3; }\n");
    String output = lines(
        "/** @interface */ function A(){}",
        "/**",
        " * @constructor",
        " */",
        "function C1(){}",
        "/**",
        " * @constructor",
        " * @extends {C1}",
        " * @implements {A}",
        " */",
        "function C2(){}",
        "/** @param {C1} x */ function f(x) { x.a = 3; }",
        "/** @param {A} x */ function g(x) { x.b = 3; }\n");
    test(js, output);
  }

  @Test
  public void testExtendsInterface() {
    String js = lines(
        "/** @interface */ function A() {}",
        "/** @interface \n @extends {A} */ function B() {}",
        "/** @param {A} x */ function f(x) { x.y = 3; }",
        "/** @param {B} x */ function g(x) { x.z = 3; }\n");
    String output = lines(
        "/** @interface */ function A(){}",
        "/** @interface \n @extends {A} */ function B(){}",
        "/** @param {A} x */ function f(x) { x.a = 3; }",
        "/** @param {B} x */ function g(x) { x.b = 3; }\n");
    test(js, output);
  }

  @Test
  public void testInterfaceWithSubInterfaceAndDirectImplementors() {
    ignoreWarnings(
        TypeValidator.INTERFACE_METHOD_NOT_IMPLEMENTED);
    test(
        lines(
            "/** @interface */ function Foo(){};",
            "Foo.prototype.foo = function(){};",
            "/** @interface @extends {Foo} */ function Bar(){};",
            "/** @constructor @implements {Foo} */ function Baz(){};",
            "Baz.prototype.baz = function(){};"),
        lines(
            "/** @interface */ function Foo(){};",
            "Foo.prototype.b = function(){};",
            "/** @interface @extends {Foo} */ function Bar(){};",
            "/** @constructor @implements {Foo} */ function Baz(){};",
            "Baz.prototype.a = function(){};"));
  }

  @Test
  public void testFunctionSubType() {
    String js = lines(
        "Function.prototype.a = 1;",
        "function f() {}",
        "f.y = 2;\n");
    String output = lines(
        "Function.prototype.a = 1;",
        "function f() {}",
        "f.b = 2;\n");
    test(js, output);
  }

  @Test
  public void testFunctionSubType2() {
    String js = lines(
        "Function.prototype.a = 1;",
        "/** @constructor */ function F() {}",
        "F.y = 2;\n");
    String output = lines(
        "Function.prototype.a = 1;",
        "/** @constructor */ function F() {}",
        "F.b = 2;\n");
    test(js, output);
  }

  @Test
  public void testPredeclaredType() {
    String js = lines(
        "goog.addDependency('zzz.js', ['goog.Foo'], []);",
        "/** @constructor */ ",
        "function A() {",
        "  this.x = 3;",
        "}",
        "/** @param {goog.Foo} x */",
        "function f(x) { x.y = 4; }");
    String result = lines(
        "0;",
        "/** @constructor */ ",
        "function A() {",
        "  this.a = 3;",
        "}",
        "/** @param {goog.Foo} x */",
        "function f(x) { x.y = 4; }");
    test(js, result);
  }

  @Test
  public void testBug14291280() {
    String js = lines(
        "/** @constructor \n @template T */\n",
        "function C() {\n",
        "  this.aa = 1;\n",
        "}\n",
        "/** @return {C.<T>} */\n",
        "C.prototype.method = function() {\n",
        "  return this;\n",
        "}\n",
        "/** @type {C.<string>} */\n",
        "var x = new C().method();\n",
        "x.bb = 2;\n",
        "x.cc = 3;");
    String result = lines(
        "/** @constructor \n @template T */\n",
        "function C() {",
        "  this.b = 1;",
        "}",
        "/** @return {C.<T>} */\n",
        "C.prototype.a = function() {",
        "  return this;",
        "};",
        "/** @type {C.<string>} */\n",
        "var x = (new C).a();",
        "x.c = 2;",
        "x.d = 3;");
    test(js, result);
  }

  @Test
  public void testAmbiguateWithAnAlias() {
    String js = lines(
        "/** @constructor */ function Foo() { this.abc = 5; }\n",
        "/** @const */ var alias = Foo;\n",
        "/** @constructor @extends alias */\n",
        "function Bar() {\n",
        "  this.xyz = 7;\n",
        "}");
    String result = lines(
        "/** @constructor */ function Foo() { this.a = 5; }\n",
        "/** @const */ var alias = Foo;\n",
        "/** @constructor @extends alias */\n",
        "function Bar() {\n",
        "  this.b = 7;\n",
        "}");
    test(js, result);
  }

  @Test
  public void testAmbiguateWithAliases() {
    String js = lines(
        "/** @constructor */ function Foo() { this.abc = 5; }\n",
        "/** @const */ var alias = Foo;\n",
        "/** @constructor @extends alias */\n",
        "function Bar() {\n",
        "  this.def = 7;\n",
        "}\n",
        "/** @constructor @extends alias */\n",
        "function Baz() {\n",
        "  this.xyz = 8;\n",
        "}");
    String result = lines(
        "/** @constructor */ function Foo() { this.a = 5; }\n",
        "/** @const */ var alias = Foo;\n",
        "/** @constructor @extends alias */\n",
        "function Bar() {\n",
        "  this.b = 7;\n",
        "}\n",
        "/** @constructor @extends alias */\n",
        "function Baz() {\n",
        "  this.b = 8;\n",
        "}");
    test(js, result);
  }

  // See https://github.com/google/closure-compiler/issues/1358
  @Test
  public void testAmbiguateWithStructuralInterfaces() {
    String js = lines(
        "/** @record */",
        "function Record() {}",
        "/** @type {number|undefined} */",
        "Record.prototype.recordProp;",
        "",
        "function f(/** !Record */ a) { use(a.recordProp); }",
        "",
        "/** @constructor */",
        "function Type() {",
        "  /** @const */",
        "  this.classProp = 'a';",
        "}",
        "f(new Type)");
    testSame(js);
  }

  // See https://github.com/google/closure-compiler/issues/2119
  @Test
  public void testUnrelatedObjectLiterals() {
    testSame(lines(
        "/** @constructor */ function Foo() {}",
        "/** @constructor */ function Bar() {}",
        "var lit1 = {a: new Foo()};",
        "var lit2 = {b: new Bar()};"));
  }

  @Test
  public void testObjectLitTwoVar() {
    String js = lines(
        "/** @constructor */ var Foo = function(){};",
        "Foo.prototype = {z:0, z:1, x:0};");
    String output = lines(
        "/** @constructor */ var Foo = function(){};",
        "Foo.prototype = {a:0, a:1, b:0};");
    test(js, output);
  }

  @Test
  public void testObjectLitTwoIndependentVar() {
    String js = lines(
        "/** @constructor */ var Foo = function(){};",
        "Foo.prototype = {b: 0};",
        "/** @constructor */ var Bar = function(){};",
        "Bar.prototype = {c: 0};");
    String output = lines(
        "/** @constructor */ var Foo = function(){};",
        "Foo.prototype = {a: 0};",
        "/** @constructor */ var Bar = function(){};",
        "Bar.prototype = {a: 0};");
    test(js, output);
  }

  @Test
  public void testObjectLitTwoTypesTwoVar() {
    String js = lines(
        "/** @constructor */ var Foo = function(){};",
        "Foo.prototype = {r: 0, g: 0};",
        "/** @constructor */ var Bar = function(){};",
        "Bar.prototype = {c: 0, r: 0};");
    String output = lines(
        "/** @constructor */ var Foo = function(){};",
        "Foo.prototype = {a: 0, b: 0};",
        "/** @constructor */ var Bar = function(){};",
        "Bar.prototype = {b: 0, a: 0};");
    test(js, output);
  }

  @Test
  public void testObjectLitUnion() {
    String js = lines(
        "/** @constructor */ var Foo = function(){};",
        "/** @constructor */ var Bar = function(){};",
        "Foo.prototype = {foodoo: 0};",
        "Bar.prototype = {bardoo: 0};",
        "/** @type {Foo|Bar} */",
        "var U = any();",
        "U.joint;");
    String output = lines(
        "/** @constructor */ var Foo = function(){};",
        "/** @constructor */ var Bar = function(){};",
        "Foo.prototype = {a: 0};",
        "Bar.prototype = {a: 0};",
        "/** @type {Foo|Bar} */",
        "var U = any();",
        "U.b;");
    test(js, output);
  }

  @Test
  public void testObjectLitUnions() {
    String js = lines(
        "/** @constructor */ var Foo = function(){};",
        "/** @constructor */ var Bar = function(){};",
        "/** @constructor */ var Baz = function(){};",
        "/** @constructor */ var Bat = function(){};",
        "Foo.prototype = {lone1: 0};",
        "Bar.prototype = {lone2: 0};",
        "Baz.prototype = {lone3: 0};",
        "Bat.prototype = {lone4: 0};",
        "/** @type {Foo|Bar} */",
        "var U1 = any();",
        "U1.j1;",
        "U1.j2;",
        "/** @type {Baz|Bar} */",
        "var U2 = any();",
        "U2.j3;",
        "U2.j4;",
        "/** @type {Baz|Bat} */",
        "var U3 = any();",
        "U3.j5;",
        "U3.j6");
    String output = lines(
        "/** @constructor */ var Foo = function(){};",
        "/** @constructor */ var Bar = function(){};",
        "/** @constructor */ var Baz = function(){};",
        "/** @constructor */ var Bat = function(){};",
        "Foo.prototype = {c: 0};",
        "Bar.prototype = {e: 0};",
        "Baz.prototype = {e: 0};",
        "Bat.prototype = {c: 0};",
        "/** @type {Foo|Bar} */",
        "var U1 = any();",
        "U1.a;",
        "U1.b;",
        "/** @type {Baz|Bar} */",
        "var U2 = any();",
        "U2.c;",
        "U2.d;",
        "/** @type {Baz|Bat} */",
        "var U3 = any();",
        "U3.a;",
        "U3.b");
    test(js, output);
  }

  @Test
  public void testObjectLitExtends() {
    String js = lines(
        "/** @constructor */ var Foo = function(){};",
        "Foo.prototype = {x: 0};",
        "/** @constructor \n @extends Foo */ var Bar = function(){};",
        "goog.inherits(Bar, Foo);",
        "Bar.prototype = {y: 0, z: 0};",
        "/** @constructor */ var Baz = function(){};",
        "Baz.prototype = {l: 0, m: 0, n: 0};",
        "(new Baz).m\n");
    String output = lines(
        "/** @constructor */ var Foo = function(){};",
        "Foo.prototype = {a: 0};",
        "/** @constructor \n @extends Foo */ var Bar = function(){};",
        "goog.inherits(Bar, Foo);",
        "Bar.prototype = {b: 0, c: 0};",
        "/** @constructor */ var Baz = function(){};",
        "Baz.prototype = {b: 0, a: 0, c: 0};",
        "(new Baz).a\n");
    test(js, output);
  }

  @Test
  public void testObjectLitLotsOfClasses() {
    StringBuilder b = new StringBuilder();
    int classes = 10;
    for (int i = 0; i < classes; i++) {
      String c = "Foo" + i;
      b.append("/** @constructor */ var ").append(c).append(" = function(){};\n");
      b.append(c).append(".prototype = {varness").append(i).append(": 0};");
    }
    String js = b.toString();
    test(js, js.replaceAll("varness\\d+", "a"));
  }

  @Test
  public void testObjectLitFunctionType() {
    String js = lines(
        "/** @constructor */ function Foo(){};",
        "Foo.prototype = { /** @return {Bar} */ fun: function() { return new Bar(); } };",
        "/** @constructor */ function Bar(){};",
        "Bar.prototype.bazz;",
        "(new Foo).fun().bazz();");
    String output = lines(
        "/** @constructor */ function Foo(){};",
        "Foo.prototype = { /** @return {Bar} */ a: function() { return new Bar(); } };",
        "/** @constructor */ function Bar(){};",
        "Bar.prototype.a;",
        "(new Foo).a().a();");
    test(js, output);
  }

  @Test
  public void testObjectLitOverlappingOriginalAndGeneratedNames() {
    test(
        lines(
            "/** @constructor */ function Bar(){};",
            "Bar.prototype = {b: function(){}, a: function(){}};",
            "var bar = new Bar();",
            "bar.b();"),
        lines(
            "/** @constructor */ function Bar(){};",
            "Bar.prototype = {a: function(){}, b: function(){}};",
            "var bar = new Bar();",
            "bar.a();"));
  }

  @Test
  public void testEnum() {
    // TODO(sdh): Consider removing this test if we decide that enum objects are
    // okay to ambiguate (in which case, this would rename to Foo.a).
    testSame(
        lines(
            "/** @enum {string} */ var Foo = {X: 'y'};",
            "var x = Foo.X"));
  }

  @Test
  public void testUnannotatedConstructorsDontCrash() {
    testSame(lines(
        "function Foo() {}",
        "Foo.prototype.a;",
        "function Bar() {}",
        "Bar.prototype.a;"));
  }

  @Test
  public void testGenericPrototypeObject() {
    String js = lines(
        "/**",
        " * @constructor",
        " * @template T",
        " */",
        "function Foo() {",
        "  this.a = 1;",
        "}",
        "/** @constructor @extends {Foo<number>} */",
        "function Bar() {}",
        "/** @constructor */",
        "function Baz() {",
        "  this.b = 2;",
        "}");

    String output = lines(
        "/**",
        " * @constructor",
        " * @template T",
        " */",
        "function Foo() {",
        "  this.a = 1;",
        "}",
        "/** @constructor @extends {Foo<number>} */",
        "function Bar() {}",
        "/** @constructor */",
        "function Baz() {",
        "  this.a = 2;",
        "}");

    test(js, output);
  }

  @Test
  public void testPropertiesWithTypesThatHaveBeenNarrowed() {
    String js = lines(
        "/** @constructor */",
        "function Foo() {",
        "  /** @type {?Object} */",
        "  this.prop1 = {};",
        "  /** @type {?Object} */",
        "  this.prop2;",
        "  this.headerObserver_;",
        "}",
        "Foo.prototype.m = function() {",
        "  this.prop2 = {};",
        "  return this.headerObserver_;",
        "};");

    String output = lines(
        "/** @constructor */",
        "function Foo() {",
        "  /** @type {?Object} */",
        "  this.d = {};",
        "  /** @type {?Object} */",
        "  this.b;",
        "  this.a;",
        "}",
        "Foo.prototype.c = function() {",
        "  this.b = {};",
        "  return this.a;",
        "};");

    test(js, output);
  }

  @Test
  public void testDontRenamePrototypeWithoutExterns() {
    String js = lines(
      "/** @interface */",
      "function Foo() {}",
      "/** @return {!Foo} */",
      "Foo.prototype.foo = function() {};");

    String output = lines(
      "/** @interface */",
      "function Foo() {}",
      "/** @return {!Foo} */",
      "Foo.prototype.a = function() {};");

    test(externs(""), srcs(js), expected(output));
  }

  @Test
  public void testInvalidRenameFunction_withZeroArgs_causesWarning() {
    testError("const p = JSCompiler_renameProperty()", Warnings.INVALID_RENAME_FUNCTION);
  }

  @Test
  public void testInvalidRenameFunction_withThreeArgs_causesWarning() {
    testError("const p = JSCompiler_renameProperty('foo', 0, 1)", Warnings.INVALID_RENAME_FUNCTION);
  }

  @Test
  public void testInvalidRenameFunction_withNonStringArg_causesWarning() {
    testError("const p = JSCompiler_renameProperty(0)", Warnings.INVALID_RENAME_FUNCTION);
  }

  @Test
  public void testInvalidRenameFunction_withPropertyRefInFirstArg_causesWarning() {
    testError("const p = JSCompiler_renameProperty('a.b')", Warnings.INVALID_RENAME_FUNCTION);
  }

  @Test
  public void testJSCompiler_renameProperty_twoArgs_blocksAmbiguation() {
    testSame(
        lines(
            "/** @constructor */",
            "function Foo() {}",
            "Foo.prototype.bar = 3;",
            "const barName = JSCompiler_renameProperty('bar', Foo);"));
  }

  @Test
  public void testJSCompiler_renameProperty_oneArg_blocksAmbiguation() {
    testSame(
        lines(
            "/** @constructor */",
            "function Foo() {}",
            "Foo.prototype.bar = 3;",
            "const barName = JSCompiler_renameProperty('bar');"));
  }

  @Test
  public void testSingleClass_withSingleMemberFn_ambiguated() {
    test("class Foo { methodFoo() {} }", "class Foo { a() {} }");
  }

  @Test
  public void testQuotedMemberFnInClass_notAmbiguated() {
    testSame("/** @dict */ class Foo { 'methodFoo'() {} }");
  }

  @Test
  public void testQuotedMemberFnInClassReservesPropertyName() {
    test(
        "/** @unrestricted */ class Foo { 'a'() {} foo() {} }",
        "/** @unrestricted */ class Foo { 'a'() {} b() {} }");
  }

  @Test
  public void testSingleClass_withTwoMemberFns_notAmbiguated() {
    test("class Foo { method1() {} method2() {} }", "class Foo { a() {} b() {} }");
  }

  @Test
  public void testSingleClass_withStaticAndPrototypeMemberFns_ambiguated() {
    test("class Foo { static method1() {} method2() {} }", "class Foo { static a() {} a() {} }");
  }

  @Test
  public void testTwoUnrelatedClasses_withMemberFns_ambiguated() {
    test(
        "class Foo { methodFoo() {} } class Bar { methodBar() {} }",
        "class Foo { a() {} } class Bar { a() {} }");
  }

  @Test
  public void testTwoUnrelatedClasses_withStaticMemberFns_ambiguatede() {
    test(
        lines(
            "class Foo { static methodFoo() {} }", //
            "class Bar { static methodBar() {} }"),
        lines(
            "class Foo { a() {} }", //
            "class Bar { a() {} }"));
  }

  @Test
  public void testEs6SuperclassStaticMethod_notAmbiguated() {
    test(
        lines(
            "class Foo { static methodFoo() {} }",
            "class Bar extends Foo { static methodBar() {} }"),
        // Since someone could access Foo.methodFoo() through Bar, make sure the methods get
        // distinct names.
        lines(
            "class Foo { static b() {} }", //
            "class Bar extends Foo { static a() {} }"));
  }

  @Test
  public void testEs6SubclassChain_withStaticMethods_notAmbiguated() {
    test(
        lines(
            "class Foo { static methodFoo() { alert('foo'); } }",
            "class Bar extends Foo { static methodBar() {alert('bar'); } }",
            "class Baz extends Bar { static methodBaz() {alert('baz'); } }",
            "class Moo extends Baz { static methodMoo() { alert('moo'); } }",
            "Moo.methodFoo();"),
        // All four static methods must get distinct names, so that Moo.a resolves correctly to
        // Foo.a
        lines(
            "class Foo { static a() {alert('foo'); } }", //
            "class Bar extends Foo { static b() {alert('bar'); } }",
            "class Baz extends Bar { static c() {alert('baz'); } }",
            "class Moo extends Baz { static d() { alert('moo'); } }",
            "Moo.a();"));
  }

  @Test
  public void testEs5ClassWithExtendsChainStaticMethods_notAmbiguated() {
    test(
        lines(
            "/** @constructor */ function Foo () {}",
            "Foo.methodFoo = function() { alert('foo'); };",
            "class Bar extends Foo { static methodBar() {alert('bar'); } }",
            "class Baz extends Bar { static methodBaz() {alert('baz'); } }",
            "class Moo extends Baz { static methodMoo() { alert('moo'); } }",
            "Moo.methodFoo();"),
        lines(
            "/** @constructor */ function Foo () {}",
            "Foo.a = function() { alert('foo'); };",
            "class Bar extends Foo { static b() {alert('bar'); } }",
            "class Baz extends Bar { static c() {alert('baz'); } }",
            "class Moo extends Baz { static d() { alert('moo'); } }",
            "Moo.a();"));
  }

  @Test
  public void testEs5ClassWithEs5SubclassWtaticMethods_ambiguated() {
    test(
        lines(
            "/** @constructor */ function Foo () {}",
            "Foo.methodFoo = function() { alert('foo'); };",
            "/** @constructor @extends {Foo} */ function Bar() {}",
            "Bar.methodBar = function() { alert('bar'); };"),
        lines(
            "/** @constructor */ function Foo () {}",
            "Foo.a = function() { alert('foo'); };",
            "/** @constructor @extends {Foo} */ function Bar() {}",
            "Bar.a = function() { alert('bar'); };"));
  }

  @Test
  public void testClassWithSuperclassStaticMethodsCalledWithSuper_ambiguated() {

    test(
        lines(
            "class Foo { static methodFoo() {} }",
            "class Bar extends Foo { static methodBar() { super.methodFoo(); } }"),
        // Since someone could access Foo.methodFoo() through Bar, make sure the methods get
        // distinct names.
        lines(
            "class Foo { static a() {} }", //
            "class Bar extends Foo { static b() { super.a(); } }"));
  }

  @Test
  public void testGetterInClass_ambiguated() {
    test("class Foo { get prop() {} }", "class Foo { get a() {} }");
  }

  @Test
  public void testQuotedGetterInClass_isNotAmbiguated() {
    testSame("/** @dict */ class Foo { get 'prop'() {} }");
  }

  @Test
  public void testQuotedGetterInClassReservesPropertyName() {
    test(
        "/** @unrestricted */ class Foo { get 'a'() {} foo() {} }",
        "/** @unrestricted */ class Foo { get 'a'() {} b() {} }");
  }

  @Test
  public void testSetterInClass_isAmbiguated() {
    test("class Foo { set prop(x) {} }", "class Foo { set a(x) {} }");
  }

  @Test
  public void testQuotedSetterInClass_notAmbiguated() {
    testSame("/** @dict */ class Foo { set 'prop'(x) {} }");
  }

  @Test
  public void testSameGetterAndSetterInClass_ambiguated() {
    test("class Foo { get prop() {} set prop(x) {} }", "class Foo { get a() {} set a(x) {} }");
  }

  @Test
  public void testDistinctGetterAndSetterInClass_notAmbiguated() {
    test("class Foo { set propA(x) {} get propB() {} }", "class Foo { set a(x) {} get b() {} }");
  }

  @Test
  public void testComputedMemberFunctionInClass_notAmbiguated() {
    testSame("/** @dict */ class Foo { ['method']() {}}");
  }

  @Test
  public void testSimpleComputedMemberFnInClassReservesPropertyName() {
    test(
        "/** @unrestricted */ class Foo { ['a']() {} foo() {} }",
        "/** @unrestricted */ class Foo { ['a']() {} b() {} }");
  }

  @Test
  public void testComplexComputedMemberFnInClassDoesntReservePropertyName() {
    // we don't try to evaluate 'a' + '' to see that it's identical to 'a', and so end up renaming
    // 'foo' -> 'a'
    // The property name invalidation is already just a heuristic, so just handle the very simple
    // case of ['a']() {}
    test(
        "/** @unrestricted */ class Foo { ['a' + '']() {} foo() {} }",
        "/** @unrestricted */ class Foo { ['a' + '']() {} a() {} }");
  }

  @Test
  public void testEs6ClassConstructorMethod_notAmbiguated() {
    testSame("class Foo { constructor() {} }");
  }

  @Test
  public void testAmbiguateEs6ClassMethodsDoesntCrashOnClassInACast() {
    // the cast causes the actual CLASS node to have the unknown type, so verify that the pass
    // can handle it not being a function type.
    testSame(
        lines(
            "const Foo = /** @type {?} */ (class {", //
            "  method() {}",
            "});",
            "class Bar {",
            "  method() {}",
            "}"));
  }

  @Test
  public void testObjectSetPrototypeOfIsIgnored() {
    test(
        externs("Object.setPrototypeOf = function(obj, proto) {}"),
        srcs(
            lines(
                "/** @constructor */",
                "function Foo() {}",
                "Foo.fooMethod = () => 3;",
                "/** @constructor */",
                "function Bar() {}",
                "Bar.barMethod = () => 4;",
                "Object.setPrototypeOf(Foo, Bar);")),
        expected(
            lines(
                "/** @constructor */",
                "function Foo() {}",
                "Foo.a = () => 3;",
                "/** @constructor */",
                "function Bar() {}",
                "Bar.a = () => 4;",
                "Object.setPrototypeOf(Foo, Bar);")));
    // now trying to reference Foo.barMethod will not work, and will call barMethod instead.
    // AmbiguateProperties currently ignores this case
  }

  @Test
  public void testComputedPropertyInObjectLiteral_notAmbiguated() {
    testSame("const obj = {['a']: 3, b: 4}");
  }

  @Test
  public void testQuotedPropertyInObjectLiteralReservesPropertyName() {
    test(
        "const obj = {'a': 3}; class C { method() {}}",
        // `method` is renamed to `b`, not `a`, to avoid colliding with the computed prop.
        // This is just a heuristic; JSCompiler cannot statically determine all string
        // property names.
        "const obj = {'a': 3}; class C { b() {}}");
  }

  @Test
  public void testQuotedMemberFnInObjectLiteralReservesPropertyName() {
    test(
        "const obj = {'a'() {}}; class C { method() {}}",
        "const obj = {'a'() {}}; class C { b() {}}");
  }

  @Test
  public void testComputedPropertyInObjectLiteralReservesPropertyName() {
    test(
        "const obj = {['a']: 3}; class C { method() {}}",
        "const obj = {['a']: 3}; class C { b() {}}");
  }

  @Test
  public void testMemberFnInObjectLiteralPreventsPropertyRenaming() {
    // Don't rename the class member 'm' because the object literal type is invalidating, and
    // also has a property 'm'
    testSame("const obj = {m() {}}; class C {m() {}}");
  }

  @Test
  public void testSimplePropInObjectLiteralPreventsPropertyRenaminge() {
    // Don't rename the class member 'm' because the object literal type is invalidating, and
    // also has a property 'm'
    testSame("const obj = {m: 0}; class C {m() {}}");
  }

  @Test
  public void testObjectPatternDeclarationWithStringKey_ambiguated() {
    test(
        lines(
            "class Foo {", //
            "  method() {}",
            "}",
            "const {method} = new Foo();"),
        lines(
            "class Foo {", //
            "  a() {}",
            "}",
            "const {a: method} = new Foo();"));
  }

  @Test
  public void testObjectPatternDeclarationWithStringKeWithDefault_ambiguated() {
    test(
        lines(
            "class Foo {", //
            "  method() {}",
            "}",
            "const {method = () => 3} = new Foo();"),
        lines(
            "class Foo {", //
            "  a() {}",
            "}",
            "const {a: method = () => 3} = new Foo();"));
  }

  @Test
  public void testNestedObjectPatternWithStringKey_ambiguated() {
    test(
        lines(
            "class Foo {", //
            "  method() {}",
            "}",
            "const {foo: {method}} = {foo: new Foo()};"),
        lines(
            "class Foo {", //
            "  a() {}",
            "}",
            // note: we rename the 'method' access but not 'foo', because we don't try ambiguating
            // properties on object literal types.
            "const {foo: {a: method}} = {foo: new Foo()};"));
  }

  @Test
  public void testObjectPatternParameterWithStringKey_ambiguated() {
    test(
        lines(
            "class Foo {", //
            "  method() {}",
            "}",
            "/** @param {!Foo} foo */",
            "function f({method}) {}"),
        lines(
            "class Foo {", //
            "  a() {}",
            "}",
            "/** @param {!Foo} foo */",
            "function f({a: method}) {}"));
  }

  @Test
  public void testObjectPatternQuotedStringKey_notAmbiguated() {
    // this emits a warning for a computed property access on a struct, since property ambiguation
    // will break this code.
    ignoreWarnings(TypeValidator.ILLEGAL_PROPERTY_ACCESS);
    test(
        lines(
            "class Foo {", //
            "  method() {}",
            "}",
            "const {'method': method} = new Foo();"),
        lines(
            "class Foo {", //
            "  a() {}",
            "}",
            "const {'method': method} = new Foo();"));
  }

  @Test
  public void testObjectPatternComputedProperty_notAmbiguated() {
    // this emits a warning for a computed property access on a struct, since property ambiguation
    // will break this code.
    ignoreWarnings(TypeValidator.ILLEGAL_PROPERTY_ACCESS);
    test(
        lines(
            "class Foo {", //
            "  method() {}",
            "}",
            "const {['method']: method} = new Foo();"),
        lines(
            "class Foo {", //
            "  a() {}",
            "}",
            "const {['method']: method} = new Foo();"));
  }
}


text:
<!DOCTYPE html>

	<meta charset="utf-8">
	<title>Source: src/input/Keyboard.js · Phaser CE</title>

	<link type="text/css" rel="stylesheet" href="styles/default.css">

	<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">

	<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">

			Phaser API

						Read Me

						Change Log

					Namespaces

							Phaser

							PIXI

					Classes

							CreatureShader

							EarCut

							Event

							EventTarget

							Animation

							AnimationManager

							AnimationParser

							ArraySet

							ArrayUtils

							AudioSprite

							BitmapData

							BitmapText

							Bullet

							Button

							Cache

							Camera

							Canvas

							CanvasPool

							Circle

							Color

							Angle

							Animation

							AutoCull

							Bounds

							BringToTop

							Core

							Crop

							Delta

							Destroy

							FixedToCamera

							Health

							InCamera

							InputEnabled

							InWorld

							LifeSpan

							LoadTexture

							Overlap

							PhysicsBody

							Reset

							ScaleMinMax

							Smoothed

							Create

							Creature

							Device

							DeviceButton

							DOM

							Easing

							Back

							Bounce

							Circular

							Cubic

							Elastic

							Exponential

							Linear

							Quadratic

							Quartic

							Quintic

							Sinusoidal

							Ellipse

							Events

							Filter

							FlexGrid

							FlexLayer

							Frame

							FrameData

							Game

							GameObjectCreator

							GameObjectFactory

							Gamepad

							Graphics

							Group

							Hermite

							Image

							ImageCollection

							Input

							InputHandler

							Key

							Keyboard

							KeyCode

							Line

							LinkedList

							Loader

							LoaderParser

							Math

							Matrix

							Mouse

							MSPointer

							Net

							Particle

							Particles

							Arcade

							Emitter

							Path

							PathFollower

							PathPoint

							Physics

							Arcade

							Body

							TilemapCollision

							Ninja

							AABB

							Body

							Circle

							Tile

							P2

							Body

							BodyDebug

							CollisionGroup

							ContactMaterial

							DistanceConstraint

							FixtureList

							GearConstraint

							InversePointProxy

							LockConstraint

							Material

							PointProxy

							PrismaticConstraint

							RevoluteConstraint

							RotationalSpring

							Spring

							Plugin

							AStar

							AStarNode

							AStarPath

							ColorHarmony

							CSS3Filters

							Juicy

							ScreenFlash

							Trail

							KineticScrolling

							PathManager

							SamplePlugin

							TilemapWalker

							VirtualJoystick

							Webcam

							PluginManager

							Point

							Pointer

							PointerMode

							Polygon

							QuadTree

							RandomDataGenerator

							Rectangle

							RenderTexture

							RequestAnimationFrame

							RetroFont

							Rope

							RoundedRectangle

							ScaleManager

							Signal

							SignalBinding

							SinglePad

							Sound

							SoundManager

							Sprite

							SpriteBatch

							Stage

							State

							StateManager

							Text

							Tile

							Tilemap

							TilemapLayer

							TilemapParser

							Tileset

							TileSprite

							Time

							Timer

							TimerEvent

							Touch

							Tween

							TweenData

							TweenManager

							Utils

							Debug

							Video

							Weapon

							World

							BaseTexture

							CanvasBuffer

							CanvasGraphics

							CanvasMaskManager

							CanvasRenderer

							CanvasTinter

							ComplexPrimitiveShader

							DisplayObject

							DisplayObjectContainer

							FilterTexture

							Phaser.GraphicsData

							PIXI

							PixiFastShader

							PixiShader

							PrimitiveShader

							Sprite

							StripShader

							Texture

							WebGLBlendModeManager

							WebGLFastSpriteBatch

							WebGLFilterManager

							WebGLRenderer

					Global

							destroy

							init

							set

					Core

Game

Group

World

Loader

Cache

Time

Camera

State Manager

Tween Manager

Sound Manager

Input Manager

Scale Manager

					Game Objects

Factory (game.add)

Creator (game.make)

Sprite

Image

Sound

Video

Particle Emitter

Particle

Text

Tween

BitmapText

Tilemap

BitmapData

RetroFont

Button

Animation

Graphics

RenderTexture

TileSprite

					Geometry

Circle

Ellipse

Line

Matrix

Point

Polygon

Rectangle

Rounded Rectangle

					Physics

Arcade Physics

Body

Weapon

P2 Physics

Body

Spring

CollisionGroup

ContactMaterial

Ninja Physics

Body

					Input

Input Handler

Pointer

Device Button

Mouse

Keyboard

Key

Key Codes

Gamepad

					 Community

Phaser Web Site

Phaser CE Github

Phaser Examples

Phaser Plugins

Forum

Stack Overflow

Tutorials

Newsletter

Twitter

Slack

Donate

Texture Packer

Source: src/input/Keyboard.js

/**
* The Keyboard class monitors keyboard input and dispatches keyboard events.
*
* _Note_: many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting.
* See http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/ for more details.
*
* Also please be aware that certain browser extensions can disable or override Phaser keyboard handling.
* For example the Chrome extension vimium is known to disable Phaser from using the D key. And there are others.
* So please check your extensions before opening Phaser issues.
*
* @class Phaser.Keyboard
* @constructor
* @param {Phaser.Game} game - A reference to the currently running game.
*/
Phaser.Keyboard = function (game) {

    /**
    * @property {Phaser.Game} game - Local reference to game.
    */
    this.game = game;

    /**
    * Keyboard input will only be processed if enabled.
    * @property {boolean} enabled
    * @default
    */
    this.enabled = true;

    /**
    * @property {object} event - The most recent DOM event from keydown or keyup. This is updated every time a new key is pressed or released.
    */
    this.event = null;

    /**
    * @property {object} pressEvent - The most recent DOM event from keypress.
    */
    this.pressEvent = null;

    /**
    * @property {object} callbackContext - The context under which the callbacks are run.
    */
    this.callbackContext = this;

    /**
    * @property {function} onDownCallback - This callback is invoked every time a key is pressed down, including key repeats when a key is held down.
    */
    this.onDownCallback = null;

    /**
    * @property {function} onPressCallback - This callback is invoked every time a DOM onkeypress event is raised, which is only for printable keys.
    */
    this.onPressCallback = null;

    /**
    * @property {function} onUpCallback - This callback is invoked every time a key is released.
    */
    this.onUpCallback = null;

    /**
    * @property {array<Phaser.Key>} _keys - The array the Phaser.Key objects are stored in.
    * @private
    */
    this._keys = [];

    /**
    * @property {array} _capture - The array the key capture values are stored in.
    * @private
    */
    this._capture = [];

    /**
    * @property {function} _onKeyDown
    * @private
    * @default
    */
    this._onKeyDown = null;

    /**
    * @property {function} _onKeyPress
    * @private
    * @default
    */
    this._onKeyPress = null;

    /**
    * @property {function} _onKeyUp
    * @private
    * @default
    */
    this._onKeyUp = null;

    /**
    * @property {number} _i - Internal cache var
    * @private
    */
    this._i = 0;

    /**
    * @property {number} _k - Internal cache var
    * @private
    */
    this._k = 0;

};

Phaser.Keyboard.prototype = {

    /**
    * Add callbacks to the Keyboard handler so that each time a key is pressed down or released the callbacks are activated.
    *
    * @method Phaser.Keyboard#addCallbacks
    * @param {object} context - The context under which the callbacks are run.
    * @param {function} [onDown=null] - This callback is invoked every time a key is pressed down.
    * @param {function} [onUp=null] - This callback is invoked every time a key is released.
    * @param {function} [onPress=null] - This callback is invoked every time the onkeypress event is raised.
    */
    addCallbacks: function (context, onDown, onUp, onPress) {

        this.callbackContext = context;

        if (onDown !== undefined && onDown !== null)
        {
            this.onDownCallback = onDown;
        }

        if (onUp !== undefined && onUp !== null)
        {
            this.onUpCallback = onUp;
        }

        if (onPress !== undefined && onPress !== null)
        {
            this.onPressCallback = onPress;
        }

    },

    /**
    * If you need more fine-grained control over a Key you can create a new Phaser.Key object via this method.
    * The Key object can then be polled, have events attached to it, etc.
    *
    * @method Phaser.Keyboard#addKey
    * @param {integer} keycode - The {@link Phaser.KeyCode keycode} of the key.
    * @return {Phaser.Key} The Key object which you can store locally and reference directly.
    */
    addKey: function (keycode) {

        if (!this._keys[keycode])
        {
            this._keys[keycode] = new Phaser.Key(this.game, keycode);

            this.addKeyCapture(keycode);
        }

        return this._keys[keycode];

    },

    /**
    * A practical way to create an object containing user selected hotkeys.
    *
    * For example,
    *
    *     addKeys( { 'up': Phaser.KeyCode.W, 'down': Phaser.KeyCode.S, 'left': Phaser.KeyCode.A, 'right': Phaser.KeyCode.D } );
    *
    * would return an object containing properties (`up`, `down`, `left` and `right`) referring to {@link Phaser.Key} object.
    *
    * @method Phaser.Keyboard#addKeys
    * @param {object} keys - A key mapping object, i.e. `{ 'up': Phaser.KeyCode.W, 'down': Phaser.KeyCode.S }` or `{ 'up': 52, 'down': 53 }`.
    * @return {object} An object containing the properties mapped to {@link Phaser.Key} values.
    */
    addKeys: function (keys) {

        var output = {};

        for (var key in keys)
        {
            output[key] = this.addKey(keys[key]);
        }

        return output;

    },

    /**
    * Removes a Key object from the Keyboard manager.
    *
    * @method Phaser.Keyboard#removeKey
    * @param {integer} keycode - The {@link Phaser.KeyCode keycode} of the key to remove.
    */
    removeKey: function (keycode) {

        if (this._keys[keycode])
        {
            this._keys[keycode] = null;

            this.removeKeyCapture(keycode);
        }

    },

    /**
    * Creates and returns an object containing 4 hotkeys for Up, Down, Left and Right.
    *
    * @method Phaser.Keyboard#createCursorKeys
    * @return {object} An object containing properties: `up`, `down`, `left` and `right` of {@link Phaser.Key} objects.
    */
    createCursorKeys: function () {

        return this.addKeys({ 'up': Phaser.KeyCode.UP, 'down': Phaser.KeyCode.DOWN, 'left': Phaser.KeyCode.LEFT, 'right': Phaser.KeyCode.RIGHT });

    },

    /**
    * Starts the Keyboard event listeners running (keydown and keyup). They are attached to the window.
    * This is called automatically by Phaser.Input and should not normally be invoked directly.
    *
    * @method Phaser.Keyboard#start
    * @protected
    */
    start: function () {

        if (this.game.device.cocoonJS)
        {
            return;
        }

        if (this._onKeyDown !== null)
        {
            //  Avoid setting multiple listeners
            return;
        }

        var _this = this;

        this._onKeyDown = function (event) {
            return _this.processKeyDown(event);
        };

        this._onKeyUp = function (event) {
            return _this.processKeyUp(event);
        };

        this._onKeyPress = function (event) {
            return _this.processKeyPress(event);
        };

        window.addEventListener('keydown', this._onKeyDown, false);
        window.addEventListener('keyup', this._onKeyUp, false);
        window.addEventListener('keypress', this._onKeyPress, false);

    },

    /**
    * Stops the Keyboard event listeners from running (keydown, keyup and keypress). They are removed from the window.
    *
    * @method Phaser.Keyboard#stop
    */
    stop: function () {

        window.removeEventListener('keydown', this._onKeyDown);
        window.removeEventListener('keyup', this._onKeyUp);
        window.removeEventListener('keypress', this._onKeyPress);

        this._onKeyDown = null;
        this._onKeyUp = null;
        this._onKeyPress = null;

    },

    /**
    * Stops the Keyboard event listeners from running (keydown and keyup). They are removed from the window.
    * Also clears all key captures and currently created Key objects.
    *
    * @method Phaser.Keyboard#destroy
    */
    destroy: function () {

        this.stop();

        this.clearCaptures();

        this._keys.length = 0;
        this._i = 0;

    },

    /**
    * By default when a key is pressed Phaser will not stop the event from propagating up to the browser.
    * There are some keys this can be annoying for, like the arrow keys or space bar, which make the browser window scroll.
    *
    * The `addKeyCapture` method enables consuming keyboard event for specific keys so it doesn't bubble up to the the browser
    * and cause the default browser behavior.
    *
    * Pass in either a single keycode or an array/hash of keycodes.
    *
    * @method Phaser.Keyboard#addKeyCapture
    * @param {integer|integer[]|object} keycode - Either a single {@link Phaser.KeyCode keycode} or an array/hash of keycodes such as `[65, 67, 68]`.
    */
    addKeyCapture: function (keycode) {

        if (typeof keycode === 'object')
        {
            for (var key in keycode)
            {
                this._capture[keycode[key]] = true;
            }
        }
        else
        {
            this._capture[keycode] = true;
        }
    },

    /**
    * Removes an existing key capture.
    *
    * @method Phaser.Keyboard#removeKeyCapture
    * @param {integer} keycode - The {@link Phaser.KeyCode keycode} to remove capturing of.
    */
    removeKeyCapture: function (keycode) {

        delete this._capture[keycode];

    },

    /**
    * Clear all set key captures.
    *
    * @method Phaser.Keyboard#clearCaptures
    */
    clearCaptures: function () {

        this._capture = {};

    },

    /**
    * Updates all currently defined keys.
    *
    * @method Phaser.Keyboard#update
    */
    update: function () {

        this._i = this._keys.length;

        while (this._i--)
        {
            if (this._keys[this._i])
            {
                this._keys[this._i].update();
            }
        }

    },

    /**
    * Process the keydown event.
    *
    * @method Phaser.Keyboard#processKeyDown
    * @param {KeyboardEvent} event
    * @protected
    */
    processKeyDown: function (event) {

        this.event = event;

        if (!this.game.input.enabled || !this.enabled)
        {
            return;
        }

        var key = event.keyCode;

        //   The event is being captured but another hotkey may need it
        if (this._capture[key])
        {
            event.preventDefault();
        }

        if (!this._keys[key])
        {
            this._keys[key] = new Phaser.Key(this.game, key);
        }

        this._keys[key].processKeyDown(event);

        this._k = key;

        if (this.onDownCallback)
        {
            this.onDownCallback.call(this.callbackContext, event);
        }

    },

    /**
    * Process the keypress event.
    *
    * @method Phaser.Keyboard#processKeyPress
    * @param {KeyboardEvent} event
    * @protected
    */
    processKeyPress: function (event) {

        this.pressEvent = event;

        if (!this.game.input.enabled || !this.enabled)
        {
            return;
        }

        if (this.onPressCallback)
        {
            this.onPressCallback.call(this.callbackContext, String.fromCharCode(event.charCode), event);
        }

    },

    /**
    * Process the keyup event.
    *
    * @method Phaser.Keyboard#processKeyUp
    * @param {KeyboardEvent} event
    * @protected
    */
    processKeyUp: function (event) {

        this.event = event;

        if (!this.game.input.enabled || !this.enabled)
        {
            return;
        }

        var key = event.keyCode;

        if (this._capture[key])
        {
            event.preventDefault();
        }

        if (!this._keys[key])
        {
            this._keys[key] = new Phaser.Key(this.game, key);
        }

        this._keys[key].processKeyUp(event);

        if (this.onUpCallback)
        {
            this.onUpCallback.call(this.callbackContext, event);
        }

    },

    /**
    * Resets all Keys.
    *
    * @method Phaser.Keyboard#reset
    * @param {boolean} [hard=true] - A soft reset won't reset any events or callbacks that are bound to the Keys. A hard reset will.
    */
    reset: function (hard) {

        if (hard === undefined) { hard = true; }

        this.event = null;

        var i = this._keys.length;

        while (i--)
        {
            if (this._keys[i])
            {
                this._keys[i].reset(hard);
            }
        }

    },

    /**
    * Returns `true` if the Key was pressed down within the `duration` value given, or `false` if it either isn't down,
    * or was pressed down longer ago than then given duration.
    *
    * @method Phaser.Keyboard#downDuration
    * @param {integer} keycode - The {@link Phaser.KeyCode keycode} of the key to check: i.e. Phaser.KeyCode.UP or Phaser.KeyCode.SPACEBAR.
    * @param {number} [duration=50] - The duration within which the key is considered as being just pressed. Given in ms.
    * @return {boolean} True if the key was pressed down within the given duration, false if not or null if the Key wasn't found.
    */
    downDuration: function (keycode, duration) {

        if (this._keys[keycode])
        {
            return this._keys[keycode].downDuration(duration);
        }
        else
        {
            return null;
        }

    },

    /**
    * Returns `true` if the Key was pressed down within the `duration` value given, or `false` if it either isn't down,
    * or was pressed down longer ago than then given duration.
    *
    * @method Phaser.Keyboard#upDuration
    * @param {Phaser.KeyCode|integer} keycode - The keycode of the key to check, i.e. Phaser.KeyCode.UP or Phaser.KeyCode.SPACEBAR.
    * @param {number} [duration=50] - The duration within which the key is considered as being just released. Given in ms.
    * @return {boolean} True if the key was released within the given duration, false if not or null if the Key wasn't found.
    */
    upDuration: function (keycode, duration) {

        if (this._keys[keycode])
        {
            return this._keys[keycode].upDuration(duration);
        }
        else
        {
            return null;
        }

    },

    justPressed: function (keycode) {

        if (this._keys[keycode])
        {
            return this._keys[keycode].justPressed();
        }
        else
        {
            return null;
        }

    },

    justReleased: function (keycode) {

        if (this._keys[keycode])
        {
            return this._keys[keycode].justReleased();
        }
        else
        {
            return null;
        }

    },

    /**
    * Returns true of the key is currently pressed down. Note that it can only detect key presses on the web browser.
    *
    * @method Phaser.Keyboard#isDown
    * @param {integer} keycode - The {@link Phaser.KeyCode keycode} of the key to check: i.e. Phaser.KeyCode.UP or Phaser.KeyCode.SPACEBAR.
    * @return {boolean} True if the key is currently down, false if not or null if the Key wasn't found.
    */
    isDown: function (keycode) {

        if (this._keys[keycode])
        {
            return this._keys[keycode].isDown;
        }
        else
        {
            return null;
        }

    }

};

/**
* Returns the string value of the most recently pressed key.
* @name Phaser.Keyboard#lastChar
* @property {string} lastChar - The string value of the most recently pressed key.
* @readonly
*/
Object.defineProperty(Phaser.Keyboard.prototype, "lastChar", {

    get: function () {

        if (this.event && this.event.charCode === 32)
        {
            return '';
        }
        else if (this.pressEvent)
        {
            return String.fromCharCode(this.pressEvent.charCode);
        }
        else
        {
            return null;
        }

    }

});

/**
* Returns the most recently pressed Key. This is a Phaser.Key object and it changes every time a key is pressed.
* @name Phaser.Keyboard#lastKey
* @property {Phaser.Key} lastKey - The most recently pressed Key.
* @readonly
*/
Object.defineProperty(Phaser.Keyboard.prototype, "lastKey", {

    get: function () {

        return this._keys[this._k];

    }

});

Phaser.Keyboard.prototype.constructor = Phaser.Keyboard;

/**
* A key code represents a physical key on a keyboard.
*
* The KeyCode class contains commonly supported keyboard key codes which can be used
* as keycode`-parameters in several {@link Phaser.Keyboard} and {@link Phaser.Key} methods.
*
* _Note_: These values should only be used indirectly, eg. as `Phaser.KeyCode.KEY`.
* Future versions may replace the actual values, such that they remain compatible with `keycode`-parameters.
* The current implementation maps to the {@link https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode KeyboardEvent.keyCode} property.
*
* _Note_: Use `Phaser.KeyCode.KEY` instead of `Phaser.Keyboard.KEY` to refer to a key code;
* the latter approach is supported for compatibility.
*
* @class Phaser.KeyCode
*/
Phaser.KeyCode = {
    /** @static */
    A: "A".charCodeAt(0),
    /** @static */
    B: "B".charCodeAt(0),
    /** @static */
    C: "C".charCodeAt(0),
    /** @static */
    D: "D".charCodeAt(0),
    /** @static */
    E: "E".charCodeAt(0),
    /** @static */
    F: "F".charCodeAt(0),
    /** @static */
    G: "G".charCodeAt(0),
    /** @static */
    H: "H".charCodeAt(0),
    /** @static */
    I: "I".charCodeAt(0),
    /** @static */
    J: "J".charCodeAt(0),
    /** @static */
    K: "K".charCodeAt(0),
    /** @static */
    L: "L".charCodeAt(0),
    /** @static */
    M: "M".charCodeAt(0),
    /** @static */
    N: "N".charCodeAt(0),
    /** @static */
    O: "O".charCodeAt(0),
    /** @static */
    P: "P".charCodeAt(0),
    /** @static */
    Q: "Q".charCodeAt(0),
    /** @static */
    R: "R".charCodeAt(0),
    /** @static */
    S: "S".charCodeAt(0),
    /** @static */
    T: "T".charCodeAt(0),
    /** @static */
    U: "U".charCodeAt(0),
    /** @static */
    V: "V".charCodeAt(0),
    /** @static */
    W: "W".charCodeAt(0),
    /** @static */
    X: "X".charCodeAt(0),
    /** @static */
    Y: "Y".charCodeAt(0),
    /** @static */
    Z: "Z".charCodeAt(0),
    /** @static */
    ZERO: "0".charCodeAt(0),
    /** @static */
    ONE: "1".charCodeAt(0),
    /** @static */
    TWO: "2".charCodeAt(0),
    /** @static */
    THREE: "3".charCodeAt(0),
    /** @static */
    FOUR: "4".charCodeAt(0),
    /** @static */
    FIVE: "5".charCodeAt(0),
    /** @static */
    SIX: "6".charCodeAt(0),
    /** @static */
    SEVEN: "7".charCodeAt(0),
    /** @static */
    EIGHT: "8".charCodeAt(0),
    /** @static */
    NINE: "9".charCodeAt(0),
    /** @static */
    NUMPAD_0: 96,
    /** @static */
    NUMPAD_1: 97,
    /** @static */
    NUMPAD_2: 98,
    /** @static */
    NUMPAD_3: 99,
    /** @static */
    NUMPAD_4: 100,
    /** @static */
    NUMPAD_5: 101,
    /** @static */
    NUMPAD_6: 102,
    /** @static */
    NUMPAD_7: 103,
    /** @static */
    NUMPAD_8: 104,
    /** @static */
    NUMPAD_9: 105,
    /** @static */
    NUMPAD_MULTIPLY: 106,
    /** @static */
    NUMPAD_ADD: 107,
    /** @static */
    NUMPAD_ENTER: 108,
    /** @static */
    NUMPAD_SUBTRACT: 109,
    /** @static */
    NUMPAD_DECIMAL: 110,
    /** @static */
    NUMPAD_DIVIDE: 111,
    /** @static */
    F1: 112,
    /** @static */
    F2: 113,
    /** @static */
    F3: 114,
    /** @static */
    F4: 115,
    /** @static */
    F5: 116,
    /** @static */
    F6: 117,
    /** @static */
    F7: 118,
    /** @static */
    F8: 119,
    /** @static */
    F9: 120,
    /** @static */
    F10: 121,
    /** @static */
    F11: 122,
    /** @static */
    F12: 123,
    /** @static */
    F13: 124,
    /** @static */
    F14: 125,
    /** @static */
    F15: 126,
    /** @static */
    COLON: 186,
    /** @static */
    EQUALS: 187,
    /** @static */
    COMMA: 188,
    /** @static */
    UNDERSCORE: 189,
    /** @static */
    PERIOD: 190,
    /** @static */
    QUESTION_MARK: 191,
    /** @static */
    TILDE: 192,
    /** @static */
    OPEN_BRACKET: 219,
    /** @static */
    BACKWARD_SLASH: 220,
    /** @static */
    CLOSED_BRACKET: 221,
    /** @static */
    QUOTES: 222,
    /** @static */
    BACKSPACE: 8,
    /** @static */
    TAB: 9,
    /** @static */
    CLEAR: 12,
    /** @static */
    ENTER: 13,
    /** @static */
    SHIFT: 16,
    /** @static */
    CONTROL: 17,
    /** @static */
    ALT: 18,
    /** @static */
    CAPS_LOCK: 20,
    /** @static */
    ESC: 27,
    /** @static */
    SPACEBAR: 32,
    /** @static */
    PAGE_UP: 33,
    /** @static */
    PAGE_DOWN: 34,
    /** @static */
    END: 35,
    /** @static */
    HOME: 36,
    /** @static */
    LEFT: 37,
    /** @static */
    UP: 38,
    /** @static */
    RIGHT: 39,
    /** @static */
    DOWN: 40,
    /** @static */
    PLUS: 43,
    /** @static */
    MINUS: 44,
    /** @static */
    INSERT: 45,
    /** @static */
    DELETE: 46,
    /** @static */
    HELP: 47,
    /** @static */
    NUM_LOCK: 144
};

// Duplicate Phaser.KeyCode values in Phaser.Keyboard for compatibility
for (var key in Phaser.KeyCode)
{
    if (Phaser.KeyCode.hasOwnProperty(key) && !key.match(/[a-z]/))
    {
        Phaser.Keyboard[key] = Phaser.KeyCode[key];
    }
}

		Phaser Copyright © 2012-2016 Photon Storm Ltd.

		Documentation generated by JSDoc 3.4.3
		on Tue Jun 20 2017 19:07:38 GMT-0700 (PDT) using the DocStrap template.


text:
package com.leeharkness.cryptostuff;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;

public class PolybiusSquareTest {

    private final String alphabet = "abcdefghiklmnopqrstuvwxyz";
    private final int SQUARE_SIZE = 5;

    @Test
    public void testThatSquareIsPopulatedInSimpleCase() {
        PolybiusSquare testSquare = new PolybiusSquare("", SQUARE_SIZE);
        char[][] square = testSquare.getPolybiusSquare();

        int i = 0;
        int j = 0;

        for (char c : alphabet.toCharArray()) {
            assertThat(square[i][j], is(c));
            j++;

            if (j > SQUARE_SIZE - 1) {
                i++;
                j = 0;
            }
        }
    }

    @Test
    public void testThatSquareIsPopulatedInSimpleKeyCase() {
        String key = "oliver";
        PolybiusSquare testSquare = new PolybiusSquare(key, SQUARE_SIZE);

        Set<Character> keyChars = key.chars().mapToObj(c -> (char)c).collect(Collectors.toSet());
        Set<Character> alphaChars = alphabet.chars().mapToObj(c -> (char)c).collect(Collectors.toSet());

        List<Character> squareChars = new ArrayList<>(keyChars);
        alphaChars.stream()
                .filter(c -> !keyChars.contains(c))
                .forEach(squareChars::add);

        char[][] square = testSquare.getPolybiusSquare();

        int i = 0;
        int j = 0;

        for (char c : squareChars) {

            assertThat(square[i][j], is(c));
            j++;

            if (j > SQUARE_SIZE - 1) {
                i++;
                j = 0;
            }
        }
    }

    @Test
    public void testThatGetCharAtWorks() {
        PolybiusSquare testSquare = new PolybiusSquare("", SQUARE_SIZE);

        int i = 0;
        int j = 0;

        for (char c : alphabet.toCharArray()) {
            assertThat(testSquare.getCharAt(i, j), is(c));
            j++;

            if (j > SQUARE_SIZE - 1) {
                i++;
                j = 0;
            }
        }
    }

    @Test
    public void testThatGetCharAtPairWorks() {
        PolybiusSquare testSquare = new PolybiusSquare("", SQUARE_SIZE);

        int i = 0;
        int j = 0;
        int curCharPos = 0;

        while (i < SQUARE_SIZE - 1) {
            PolybiusSquare.RowColumnPair curPair = new PolybiusSquare.RowColumnPair(i, j);
            assertEquals(testSquare.getCharAt(curPair), alphabet.charAt(curCharPos));
            curCharPos++;
            j++;
            if (j > SQUARE_SIZE - 1) {
                i++;
                j = 0;
            }
        }
    }

    @Test
    public void testThatGetPairForWorks() {
        PolybiusSquare testSquare = new PolybiusSquare("", SQUARE_SIZE);

        int i = 0;
        int j = 0;
        int curCharPos = 0;

        while (i < SQUARE_SIZE - 1) {
            PolybiusSquare.RowColumnPair expectedPair = new PolybiusSquare.RowColumnPair(i, j);
            assertThat(testSquare.getPairFor(alphabet.charAt(curCharPos)), is(expectedPair));
            curCharPos++;
            j++;
            if (j > SQUARE_SIZE - 1) {
                i++;
                j = 0;
            }
        }
    }

    @Test
    public void testThatGetPairForReturnsEmptyPairForCharNotItSquare() {
        PolybiusSquare testSquare = new PolybiusSquare("", SQUARE_SIZE);

        assertThat(testSquare.getPairFor('1'), is(new PolybiusSquare.RowColumnPair()));
    }

}


text:
@interface BBSApiBaseTableViewController : TranslateDataUITableViewController

@property(nonatomic, strong) id <BBSApiDelegate> forumApi;
@property(nonatomic, strong) NSMutableArray *dataList;
@property(nonatomic, strong) PageNumber *pageNumber;

- (void)onPullRefresh;

- (void)onLoadMore;

- (BOOL)setPullRefresh:(BOOL)enable;

- (BOOL)setLoadMore:(BOOL)enable;

- (BOOL)autoPullfresh;

- (NSString *)currentForumHost;

- (BOOL)isNeedHideLeftMenu;

@end


text:
<?php

if (isset($_COOKIE['allow_cookies']) && $_COOKIE['allow_cookies'] == 1) {
	header('Location: https://elementary.today/start/',TRUE,302);
	die();
}

$Meta = '<title>Разрешить Cookies?  ·  elementary Search</title>';
require 'header.php'; ?>

Хотите ли Вы включить Cookies?

Вы можете изменить своё решение в любое время в меню настроек.

Файлы cookie представляют собой небольшие файлы, сохраняемые на Вашем компьютере веб-браузером по требованию сайта, который Вы просматриваете. В данном случае это позволяет сайту запоминать Ваши настройки.

Нет

Да

				Настройки

		<?php require 'legal.php'; ?>

Настройки

Cookies

					<input id="view" type="checkbox"<?php if (isset($_COOKIE['allow_cookies']) && $_COOKIE['allow_cookies'] == 1) echo ' checked'; ?>/>

						Включить
						Отключить

Затемнение

				<div class="control darken enabled switch switch-three candy" onclick="" <?php if (!isset($_COOKIE['allow_cookies']) && $_COOKIE['allow_cookies'] != 1) echo ' style="display:none;"'; ?>>
					<input id="never" name="view" type="radio"<?php if (isset($_COOKIE['darken']) && $_COOKIE['darken'] == 'never') echo ' checked'; ?>>
					Никогда
					<input id="hover" name="view" type="radio"<?php if (isset($_COOKIE['darken']) && $_COOKIE['darken'] == 'hover') echo ' checked'; ?><?php if (!isset	($_COOKIE['darken'])) echo ' checked'; ?>>
					При наведении
					<input id="always" name="view" type="radio"<?php if (isset($_COOKIE['darken']) && $_COOKIE['darken'] == 'always') echo ' checked'; ?>>
					Всегда

				<div class="control darken disabled switch switch-three candy" onclick="" <?php if (isset($_COOKIE['allow_cookies']) || $_COOKIE['allow_cookies'] == 1) echo ' style="display:none;"'; ?>>

Вы должны включить cookies для изменения настроек.


text: A package for transforming .svgs into modules so you can require them.


text:
#include "mvc/model/metadata/session.h"
#include "mvc/model/metadata.h"
#include "mvc/model/metadatainterface.h"

#include "kernel/main.h"
#include "kernel/memory.h"
#include "kernel/array.h"
#include "kernel/object.h"
#include "kernel/concat.h"
#include "kernel/fcall.h"

/**
 * Phalcon\Mvc\Model\MetaData\Session
 *
 * Stores model meta-data in session. Data will erased when the session finishes.
 * Meta-data are permanent while the session is active.
 *
 * You can query the meta-data by printing $_SESSION['$PMM$']
 *
 *
 * $metaData = new Phalcon\Mvc\Model\Metadata\Session(array(
 *    'prefix' => 'my-app-id'
 * ));
 *
 */
zend_class_entry *phalcon_mvc_model_metadata_session_ce;

PHP_METHOD(Phalcon_Mvc_Model_MetaData_Session, __construct);
PHP_METHOD(Phalcon_Mvc_Model_MetaData_Session, read);
PHP_METHOD(Phalcon_Mvc_Model_MetaData_Session, write);
PHP_METHOD(Phalcon_Mvc_Model_MetaData_Session, reset);

ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_mvc_model_metadata_session___construct, 0, 0, 0)
	ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO()

static const zend_function_entry phalcon_mvc_model_metadata_session_method_entry[] = {
	PHP_ME(Phalcon_Mvc_Model_MetaData_Session, __construct, arginfo_phalcon_mvc_model_metadata_session___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
	PHP_ME(Phalcon_Mvc_Model_MetaData_Session, read, arginfo_phalcon_mvc_model_metadatainterface_read, ZEND_ACC_PUBLIC)
	PHP_ME(Phalcon_Mvc_Model_MetaData_Session, write, arginfo_phalcon_mvc_model_metadatainterface_write, ZEND_ACC_PUBLIC)
	PHP_ME(Phalcon_Mvc_Model_MetaData_Session, reset, arginfo_phalcon_mvc_model_metadatainterface_reset, ZEND_ACC_PUBLIC)
	PHP_FE_END
};

/**
 * Phalcon\Mvc\Model\MetaData\Session initializer
 */
PHALCON_INIT_CLASS(Phalcon_Mvc_Model_MetaData_Session){

	PHALCON_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\MetaData, Session, mvc_model_metadata_session, phalcon_mvc_model_metadata_ce, phalcon_mvc_model_metadata_session_method_entry, 0);

	zend_declare_property_string(phalcon_mvc_model_metadata_session_ce, SL("_prefix"), "", ZEND_ACC_PROTECTED TSRMLS_CC);

	zend_class_implements(phalcon_mvc_model_metadata_session_ce TSRMLS_CC, 1, phalcon_mvc_model_metadatainterface_ce);

	return SUCCESS;
}

/**
 * Phalcon\Mvc\Model\MetaData\Session constructor
 *
 * @param array $options
 */
PHP_METHOD(Phalcon_Mvc_Model_MetaData_Session, __construct){

	zval *options = NULL, *prefix, *empty_array;

	phalcon_fetch_params(0, 0, 1, &options);

	if (options && Z_TYPE_P(options) == IS_ARRAY) {
		if (phalcon_array_isset_string_fetch(&prefix, options, SS("prefix"))) {
			phalcon_update_property_this(this_ptr, SL("_prefix"), prefix TSRMLS_CC);
		}
	}

	PHALCON_ALLOC_GHOST_ZVAL(empty_array);
	array_init(empty_array);
	phalcon_update_property_this(this_ptr, SL("_metaData"), empty_array TSRMLS_CC);
}

/**
 * Reads meta-data from $_SESSION
 *
 * @param string $key
 * @return array
 */
PHP_METHOD(Phalcon_Mvc_Model_MetaData_Session, read){

	zval *key, *session, *prefix, *prefix_key;
	zval *meta_data;
	zval *r0, *r1 = NULL;

	PHALCON_MM_GROW();

	phalcon_fetch_params(0, 1, 0, &key);

	session = phalcon_get_global(SS("_SESSION") TSRMLS_CC);

	prefix = phalcon_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY TSRMLS_CC);

	PHALCON_INIT_VAR(prefix_key);
	PHALCON_CONCAT_SV(prefix_key, "$PMM$", prefix);
	if (phalcon_array_isset_fetch(&r0, session, prefix_key)) {

		if (phalcon_array_isset(r0, key)) {
			PHALCON_OBS_VAR(r1);
			phalcon_array_fetch(&r1, session, prefix_key, PH_NOISY);
			PHALCON_OBS_VAR(meta_data);
			phalcon_array_fetch(&meta_data, r1, key, PH_NOISY);
			RETURN_CCTOR(meta_data);
		}
	}

	RETURN_MM_NULL();
}

/**
 * Writes the meta-data to $_SESSION
 *
 * @param string $key
 * @param array $data
 */
PHP_METHOD(Phalcon_Mvc_Model_MetaData_Session, write){

	zval *key, *data, *prefix, *prefix_key, *_SESSION;

	PHALCON_MM_GROW();

	phalcon_fetch_params(1, 2, 0, &key, &data);

	prefix = phalcon_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY TSRMLS_CC);

	PHALCON_INIT_VAR(prefix_key);
	PHALCON_CONCAT_SV(prefix_key, "$PMM$", prefix);
	_SESSION = phalcon_get_global(SS("_SESSION") TSRMLS_CC);
	phalcon_array_update_multi_2(&_SESSION, prefix_key, key, data, 0);

	PHALCON_MM_RESTORE();
}

PHP_METHOD(Phalcon_Mvc_Model_MetaData_Session, reset)
{
	zval prefix_key = zval_used_for_init, *pprefix = &prefix_key, *_SESSION;
	zval *prefix = phalcon_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY TSRMLS_CC);

	phalcon_concat_sv(&pprefix, SL("$PMM$"), prefix, 0 TSRMLS_CC);
	_SESSION = phalcon_get_global(SS("_SESSION") TSRMLS_CC);
	phalcon_array_unset(&_SESSION, &prefix_key, 0);
	zval_dtor(&prefix_key);

	PHALCON_CALL_PARENTW(NULL, phalcon_mvc_model_metadata_session_ce, getThis(), "reset");
}


text:
title: DropdownNav
path: component/dropdown-nav
group: Navigation
---

## DropdownNav

DropdownNav is used for accept links

It can only be used under specific circumstances. If the use conditions are not met, it can be encapsulated by Dropdown.

### API

| Props           | Description                            | Type     | Default      |
| ------------ | ----------------------------- | ------ | -------- |
| trigger        | trigger type                      | `hover` `click`   | `hover`     |
| list     | array of nav | `Array<{key: string, label: string}>`   | `[]`   |
| onItemClick      | Item click callback                      | `(event, key) => void`   | `noop`   |


text:
package io.github.flibiostudio.updatifier;

public class ReleaseData {

    private String tag_name;
    private String body;
    private boolean prerelease;
    private String html_url;
    private String published_at;
    private AssetData[] assets;

    public String getName() {
        return tag_name;
    }

    public String getUrl() {
        return html_url;
    }

    public String publishedAt() {
        return published_at;
    }

    public boolean isPreRelease() {
        return prerelease;
    }

    public String body() {
        return body;
    }

    public AssetData[] assets() {
        return assets;
    }

}


text:
namespace sip0x
{
  namespace parser
  {

    // Content-Language  =  "Content-Language" HCOLON
    //                      language-tag *(COMMA language-tag)
    // language-tag      =  primary-tag *( "-" subtag )
    // primary-tag       =  1*8ALPHA
    // subtag            =  1*8ALPHA
    class TokenSIPMessageHeader_Content_Language : public TokenSIPMessageHeader_base<Sequence<TokenRegex, TokenLWS, TokenSIPMethod>> {

    protected:

    public:
      //
      TokenSIPMessageHeader_Content_Language() : TokenSIPMessageHeader_base("Content-Language", "Content\\-Language",
        Sequence<TokenRegex, TokenLWS, TokenSIPMethod>
        (
          TokenDigits(),
          TokenLWS(),
          TokenSIPMethod()
        )
      )
      {
      }
    };

  }
}

#endif // SIP0X_PARSER_TOKENSIPMESSAGEHEADER_CONTENT_LANGUAGE_HPP__