Page MenuHomeWildfire Games

Remove JSInterface_IGUIObject duplication
Changes PlannedPublic

Authored by elexis on Aug 3 2019, 3:17 AM.

Details

Reviewers
None
Summary

This patch performs the following cleanup on JSInterface_IGUIObject:

  • Replace JS_THIS_OBJECT deprecated in SpiderMonkey 61 with JS::CallArgs or JS::CallReceiver thisv(), refs D1699, https://bugzilla.mozilla.org/show_bug.cgi?id=1255800
  • Unify the 7 copies of the JS_GetInstancePrivate call and its dependencies.
  • Unify the 2 copies of the GetProperty and SetProperty attribute handling code.
  • Unify the 2 copies of the GetEventName code.
  • Move GetParent, GetChildren, GetName, GetEventHandler, SetEventHandler to a custom function.
  • Move a conversion to ToJSVal<CRect>.
  • Rename e to obj.

This makes JSI_IGUIObject::getProperty and setProperty agnostic of the handling per property,
thus enabled developers to change the way the properties and functions are accessed and set.

Test Plan

Make sure the code behavior is the same and that all functions are inlined.
Can we remove those lambdas somehow?
Compile it on gcc, clang and VS2015.

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
/ps/trunk
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 8709
Build 14266: Vulcan BuildJenkins
Build 14265: arc lint + arc unit

Event Timeline

elexis created this revision.Aug 3 2019, 3:17 AM
elexis edited the summary of this revision. (Show Details)Aug 3 2019, 3:18 AM
Vulcan added a comment.Aug 3 2019, 3:41 AM

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/gui/scripting/JSInterface_IGUIObject.h
|  26| namespace·JSI_IGUIObject
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'namespaceJSI_IGUIObject{' is invalid C code. Use --std or --language to configure the language.

source/gui/IGUIObject.h
| 169| »   ·*·completely·transparent·to·the·interfacially·sequential·model.
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCClientArea{' is invalid C code. Use --std or --language to configure the language.

source/gui/IGUITextOwner.h
| 169| The line belonging to the following result cannot be printed because it refers to a line that doesn't seem to exist in the given file.
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCClientArea{' is invalid C code. Use --std or --language to configure the language.

source/gui/scripting/JSInterface_IGUITextOwner.h
|  25| namespace·JSI_IGUITextOwner
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'namespaceJSI_IGUITextOwner{' is invalid C code. Use --std or --language to configure the language.

source/scriptinterface/NativeWrapperDefns.h
|   1| /*·Copyright·(C)·2017·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2017"

source/scriptinterface/NativeWrapperDefns.h
|  26| template·<typename·T>·struct·ScriptInterface::MaybeRef
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'template<...' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/293/display/redirect

elexis retitled this revision from Remove JSInterface_IGUIObject duplication to Remove JSInterface_IGUIObject duplication / remove JS_THIS_OBJECT.Aug 3 2019, 9:47 PM
elexis retitled this revision from Remove JSInterface_IGUIObject duplication / remove JS_THIS_OBJECT to Remove JSInterface_IGUIObject duplication.Aug 20 2019, 11:38 PM
elexis planned changes to this revision.Sep 4 2019, 3:55 PM

Needs rebase, since the SpiderMonkey macro removal was committed independently, and since ToJSVal<CRect> was moved to a different diff.