Fix stmt value being the raw value (#557)

This commit is contained in:
Daniel Tschinder 2017-06-03 16:16:45 +02:00 committed by GitHub
parent edf34dc780
commit 0656717552
2 changed files with 13 additions and 2 deletions

View File

@ -125,6 +125,17 @@ export default (superClass: Class<Parser>): Class<Parser> => class extends super
(!stmt.expression.extra || !stmt.expression.extra.parenthesized);
}
stmtToDirective(stmt: N.Statement): N.Directive {
const directive = super.stmtToDirective(stmt);
const value = stmt.expression.value;
// Reset value to the actual value as in estree mode we want
// the stmt to have the real value and not the raw value
directive.value.value = value;
return directive;
}
parseBlockBody(node: N.BlockStatementLike, ...args): void {
super.parseBlockBody(node, ...args);

View File

@ -56,11 +56,11 @@
"column": 15
}
},
"value": "use\\x20strict",
"value": "use strict",
"raw": "\"use\\x20strict\""
},
"directive": "use\\x20strict"
}
]
}
}
}