Skip to content

Commit 319ba7b

Browse files
brad4dblickly
authored andcommitted
IntegrationTest case for @noinline annotation
Related to #2751 Not all of the Inline* passes honor the @noinline annotation yet, but this test shows that it basically works as expected in the common case. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=179851747
1 parent af85411 commit 319ba7b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/com/google/javascript/jscomp/IntegrationTest.java

+22
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.google.javascript.jscomp;
1818

1919
import static com.google.common.truth.Truth.assertThat;
20+
import static com.google.javascript.jscomp.CompilerTestCase.lines;
2021
import static com.google.javascript.jscomp.TypeValidator.TYPE_MISMATCH_WARNING;
2122

2223
import com.google.common.annotations.GwtIncompatible;
@@ -48,6 +49,27 @@ public final class IntegrationTest extends IntegrationTestCase {
4849
private static final String CLOSURE_COMPILED =
4950
"var COMPILED = true; var goog$exportSymbol = function() {};";
5051

52+
public void testNoInline() {
53+
CompilerOptions options = createCompilerOptions();
54+
CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options);
55+
test(
56+
options,
57+
lines(
58+
"var namespace = {};", // preserve newlines
59+
"/** @noinline */ namespace.foo = function() { alert('foo'); };",
60+
"namespace.foo();"),
61+
lines(
62+
"function a() { alert('foo'); }", // preserve newlines
63+
"a();"));
64+
test(
65+
options,
66+
lines(
67+
"var namespace = {};", // preserve newlines
68+
"namespace.foo = function() { alert('foo'); };",
69+
"namespace.foo();"),
70+
"alert('foo');");
71+
}
72+
5173
public void testIssue2365() {
5274
CompilerOptions options = createCompilerOptions();
5375
CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options);

0 commit comments

Comments
 (0)