[gnome-builder] gjs_symbols: don't choke on toplevel destructuring assingments
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] gjs_symbols: don't choke on toplevel destructuring assingments
- Date: Mon, 4 Dec 2017 00:22:49 +0000 (UTC)
commit 4b0cf068afdd1842a4e8999af94d4dbd45b4d469
Author: Giovanni Campagna <gcampagn cs stanford edu>
Date: Sun Nov 26 02:37:00 2017 -0800
gjs_symbols: don't choke on toplevel destructuring assingments
A destructuring assignment Pattern does not have a 'name' property,
which would crash the symbol extractor and abort everything.
https://bugzilla.gnome.org/show_bug.cgi?id=790846
src/plugins/gjs-symbols/gjs_symbols.py | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gjs-symbols/gjs_symbols.py b/src/plugins/gjs-symbols/gjs_symbols.py
index ddd59e5..e37026d 100644
--- a/src/plugins/gjs-symbols/gjs_symbols.py
+++ b/src/plugins/gjs-symbols/gjs_symbols.py
@@ -99,6 +99,9 @@ class JsSymbolTree(GObject.Object, Ide.SymbolTree):
for dec in dict_['declarations']:
line = max(dec['id']['loc']['start']['line'] - 1, 0)
col = dec['id']['loc']['start']['column']
+ if dec['id']['type'] != 'Identifier':
+ # destructured assignment, ignore
+ return
name = dec['id']['name']
kind = Ide.SymbolKind.VARIABLE
children = []
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]