0

Fix in compiler pass: cr.defineProperty() with 2 arguments means opt_kind == cr.PropertyKind.JS

BUG=393873
R=tbreisacher@chromium.org

Review URL: https://codereview.chromium.org/473853003

Cr-Commit-Position: refs/heads/master@{#289902}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289902 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
vitalyp@chromium.org
2014-08-15 16:24:26 +00:00
parent 19cf2f78c8
commit c4d3e3f158
2 changed files with 12 additions and 3 deletions
third_party/closure_compiler/runner
src
com
google
javascript
test
com
google
javascript

@ -107,15 +107,15 @@ public class ChromePass extends AbstractPostOrderCallback implements CompilerPas
}
private Node getTypeByCrPropertyKind(Node propertyKind) {
if (propertyKind == null || propertyKind.matchesQualifiedName("cr.PropertyKind.JS")) {
return new Node(Token.QMARK);
}
if (propertyKind.matchesQualifiedName("cr.PropertyKind.ATTR")) {
return IR.string("string");
}
if (propertyKind.matchesQualifiedName("cr.PropertyKind.BOOL_ATTR")) {
return IR.string("boolean");
}
if (propertyKind.matchesQualifiedName("cr.PropertyKind.JS")) {
return new Node(Token.QMARK);
}
compiler.report(JSError.make(propertyKind, CR_DEFINE_PROPERTY_INVALID_PROPERTY_KIND,
propertyKind.getQualifiedName()));
return null;

@ -219,6 +219,15 @@ public class ChromePassTest extends CompilerTestCase {
"a.prototype.c;");
}
public void testCrDefinePropertyCalledWithouthThirdArgumentMeansCrPropertyKindJs()
throws Exception {
test(
"cr.defineProperty(a.prototype, 'c');",
"cr.defineProperty(a.prototype, 'c');\n" +
"/** @type {?} */\n" +
"a.prototype.c;");
}
public void testCrDefinePropertyDefinesUnquotedPropertyOnPrototypeWhenFunctionIsPassed()
throws Exception {
test(