[geany/geany] b596aa: JavaScript: don't choke when returning object literals
Colomban Wendling
git-noreply at xxxxx
Sun Aug 3 14:57:26 UTC 2014
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Sun, 03 Aug 2014 14:57:26 UTC
Commit: b596aa14e82967d02d711c48cd62e631c29bea65
https://github.com/geany/geany/commit/b596aa14e82967d02d711c48cd62e631c29bea65
Log Message:
-----------
JavaScript: don't choke when returning object literals
Modified Paths:
--------------
tagmanager/ctags/js.c
tests/ctags/Makefile.am
tests/ctags/complex-return.js
tests/ctags/complex-return.js.tags
Modified: tagmanager/ctags/js.c
4 lines changed, 4 insertions(+), 0 deletions(-)
===================================================================
@@ -1663,6 +1663,10 @@ static boolean parseLine (tokenInfo *const token, boolean is_inside_class)
case KEYWORD_switch:
parseSwitch (token);
break;
+ case KEYWORD_return:
+ findCmdTerm (token);
+ is_terminated = isType (token, TOKEN_SEMICOLON);
+ break;
default:
is_terminated = parseStatement (token, is_inside_class);
break;
Modified: tests/ctags/Makefile.am
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -112,6 +112,7 @@ test_sources = \
char-selector.f90 \
classes.php \
common.f \
+ complex-return.js \
continuation.f90 \
countall.sql \
cpp_destructor.cpp \
Modified: tests/ctags/complex-return.js
61 lines changed, 61 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,61 @@
+
+function func1() {
+ return { a: 1, b:2 };
+}
+
+function func2() {
+ return 42;
+}
+
+var class1 = function() {
+ this.method1 = function() {
+ return 42;
+ };
+ this.method2 = function() {
+ return { a:1, b:2 };
+ };
+ this.method3 = function() {
+ return [1, 2, 3];
+ };
+ this.method4 = function() {
+ return "hello";
+ };
+};
+
+var class2 = function() {
+ this.c2m1 = function() {
+ c2m3(function() {
+ return { 'test': {} };
+ });
+ };
+ this.c2m2 = function(f) {
+ return { 'ret': f() };
+ };
+ this.c2m3 = function(f) {
+ return f();
+ };
+};
+
+var class3 = function() {
+ this.c3m1 = function() {
+ return function(n) {
+ if (n == 42) {
+ return 0;
+ } else {
+ return (n + 1) % 42;
+ }
+ };
+ };
+ this.c3m2 = function() {
+ return 0;
+ };
+}
+
+var class4 = function() {
+ this.method1 = function() {
+ return [{a:1, b:2}, {a:3, b:4}, {a:5, b:6}];
+ };
+ this.method2 = function() {
+ return 0;
+ };
+};
Modified: tests/ctags/complex-return.js.tags
18 lines changed, 18 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,18 @@
+# format=tagmanager
+c2m1�128�class2�0
+c2m2�128�class2�0
+c2m3�128�class2�0
+c3m1�128�class3�0
+c3m2�128�class3�0
+class1�1�0
+class2�1�0
+class3�1�0
+class4�1�0
+func1�16�0
+func2�16�0
+method1�128�class1�0
+method1�128�class4�0
+method2�128�class1�0
+method2�128�class4�0
+method3�128�class1�0
+method4�128�class1�0
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list