From da60eda00bd028eea404a5c505723b53f117c733 Mon Sep 17 00:00:00 2001 From: nickreid Date: Thu, 16 May 2019 15:50:03 -0700 Subject: [PATCH] Add an additional test for static method disambiguation on ES5 classes. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=248616183 --- .../jscomp/DisambiguatePropertiesTest.java | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/test/com/google/javascript/jscomp/DisambiguatePropertiesTest.java b/test/com/google/javascript/jscomp/DisambiguatePropertiesTest.java index 0cb8e9a76a4..2b94b43780d 100644 --- a/test/com/google/javascript/jscomp/DisambiguatePropertiesTest.java +++ b/test/com/google/javascript/jscomp/DisambiguatePropertiesTest.java @@ -2987,7 +2987,32 @@ public void testQuotedEs6ClassSetters_areNotDisambiguated() { } @Test - public void testDisambiguateEs6ClassStaticMethods() { + public void testDisambiguateEs5StaticMethods_declaredOutsideBody() { + test( + lines( + "/** @constructor */", + "function Foo() {}", + "Foo.method = function() { };", + "", + "class Bar {}", + "Bar.method = function() { };", + "", + "Foo.method();", + "Bar.method();"), + lines( + "/** @constructor */", + "function Foo() {}", + "Foo._typeof_Foo_$method = function() {}", + "", + "class Bar {}", + "Bar._typeof_Bar_$method = function() {}", + "", + "Foo._typeof_Foo_$method();", + "Bar._typeof_Bar_$method();")); + } + + @Test + public void testDisambiguateEs6ClassStaticMethods_declaredInsideBody() { test( lines( "class Foo {",