BrightScript: Allow sub to be unnamed
ClosedPublic

Authored by dlevin on Nov 28 2018, 5:00 AM.

Details

Summary

Subs and functions could be unnamed in closures.

Diff Detail

Repository
R216 Syntax Highlighting
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
dlevin created this revision.Nov 28 2018, 5:00 AM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptNov 28 2018, 5:00 AM
Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel. · View Herald Transcript
dlevin requested review of this revision.Nov 28 2018, 5:00 AM
cullmann requested changes to this revision.Nov 28 2018, 6:34 AM

Looks reasonable, but you need to increase the version.

This revision now requires changes to proceed.Nov 28 2018, 6:34 AM
dlevin updated this revision to Diff 46371.Nov 28 2018, 6:44 AM

Thanks for the review. Btw, is there any chance to preserve my name/email in the final commit?

cullmann accepted this revision.Nov 28 2018, 7:41 AM

Sure :/ I missed to change author last time, I normally am just patching/landing via arc, but that doesn't always contain that.

This revision is now accepted and ready to land.Nov 28 2018, 7:41 AM
This revision was automatically updated to reflect the committed changes.
dfaure added a subscriber: dfaure.Nov 30 2018, 10:46 AM

It seems this commit is the reason for the unittest failure below?

https://build.kde.org/job/Frameworks/view/Everything/job/syntax-highlighting/job/kf5-qt5%20SUSEQt5.10/258/testReport/junit/(root)/TestSuite/folding_test/

--- "/home/jenkins/workspace/Frameworks/syntax-highlighting/kf5-qt5 SUSEQt5.10/autotests/folding/brightscript.brs.fold"	2018-11-28 07:43:45.708060965 +0000
+++ "/home/jenkins/workspace/Frameworks/syntax-highlighting/kf5-qt5 SUSEQt5.10/build/autotests/folding.out/brightscript.brs.fold"	2018-11-28 07:45:08.202953752 +0000
@@ -96,4 +96,10 @@
 
 b.foo("string",1,{a:b},1.5,[1,2,3])
 a = b.foo("string",1,{a:b},1.5,[1,2,3])
+
+unnamed_function = function ( a as Integer ) as Float
+end function
+
+unnamed_sub = sub ( a as Integer ) as Void
+end sub
 endFunction
FAIL!  : FoldingTest::testFolding(brightscript.brs) Compared values are not the same
   Actual   (proc.exitCode()): 1
   Expected (0)              : 0

Upsa, you are right.

This language does not have folding test. I did not provide validation for it before. Should I do that?