Skip to content

Commit

Permalink
Correct change tracking in InlineObjectLiterals and enable the unit t…
Browse files Browse the repository at this point in the history
…est.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153868569
  • Loading branch information
concavelenz authored and Tyler Breisacher committed Apr 25, 2017
1 parent 61887b8 commit b0380df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/com/google/javascript/jscomp/InlineObjectLiterals.java
Expand Up @@ -426,15 +426,17 @@ private void splitObject(Var v, Reference init,
}

if (defined) {
compiler.reportChangeToEnclosingScope(vnode.getParent());
vnode.getParent().removeChild(vnode);
}

for (Reference ref : referenceInfo.references) {
compiler.reportChangeToEnclosingScope(ref.getNode());

// The init/decl have already been converted.
if (defined && ref == init) {
continue;
}
compiler.reportChangeToEnclosingScope(ref.getNode());

if (ref.isLvalue()) {
// Assignments have to be handled specially, since they
Expand Down
Expand Up @@ -30,7 +30,6 @@ public InlineObjectLiteralsTest() {
@Override
protected void setUp() throws Exception {
super.setUp();
validateAstChangeMarking(false);
}

@Override
Expand Down Expand Up @@ -333,8 +332,11 @@ public void testObject26() {
"new JSCompiler_object_inline_b_0.c");
}

public void testBug545() {
public void testBug545a() {
testLocal("var a = {}", "");
}

public void testBug545b() {
testLocal("var a; a = {}", "true");
}

Expand Down

0 comments on commit b0380df

Please sign in to comment.