Commit 72908fec authored by Joel Einbinder's avatar Joel Einbinder Committed by Commit Bot

DevTools: Fix autocomplete for this expressions on pause

`ThisExpression` is not considered an `Identifier`, but it should
similarly have no side effects.

Change-Id: I894869716541dd9692d96938db76b2b3a1d3b1a1
Reviewed-on: https://chromium-review.googlesource.com/1028187Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Commit-Queue: Joel Einbinder <einbinder@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553839}
parent 3a01c225
......@@ -46,5 +46,8 @@ PASS
Running: step15_ShouldNotCrash
PASS
Running: step16
PASS
Script execution resumed.
......@@ -93,6 +93,11 @@
function step15_ShouldNotCrash(next) {
ObjectUI.javaScriptAutocomplete._completionsForExpression('arr3.', '')
.then(checkAgainstGolden.bind(this, ['length'], ['1', '2', '3'], next));
},
function step16(next) {
ObjectUI.javaScriptAutocomplete._completionsForExpression('this.', 'win')
.then(checkAgainstGolden.bind(this, ['window'], ['arr3'], next));
}
]);
......
......@@ -373,7 +373,7 @@ FormatterWorker.findLastExpression = function(content) {
baseExpression = `(${baseExpression})`;
const sideEffectFreeTypes = new Set([
'MemberExpression', 'Identifier', 'BinaryExpression', 'Literal', 'TemplateLiteral', 'TemplateElement',
'ObjectExpression', 'ArrayExpression', 'Property'
'ObjectExpression', 'ArrayExpression', 'Property', 'ThisExpression'
]);
let possibleSideEffects = false;
const sideEffectwalker = new FormatterWorker.ESTreeWalker(node => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment