Last active
August 29, 2015 14:06
-
-
Save chriscdn/d9b20e1ad4f3e853d0ac to your computer and use it in GitHub Desktop.
A function for making super calls in OpenText Content Server OScript.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Christopher Meyer [email protected] | |
* Copyright 2014 Red House Consulting GmbH | |
* | |
* Version: 1.3 | |
*/ | |
function Dynamic super(Object item, String func) | |
switch GetMethodType(item, func) | |
// root defined valued | |
case 0 | |
return Undefined | |
end | |
// override from parent | |
case 1 | |
return GetMethodFromParent(item, func) | |
end | |
// inherited featured | |
case 2 | |
return super( GetParent(item), func ) | |
end | |
end | |
end | |
function Dynamic GetObject(Dynamic item) | |
if Type(item) == Frame.FrameType | |
return GetObject( Frame.Parents(item)[1][2] ) | |
end | |
return item | |
end | |
function Integer GetMethodType(Dynamic item, String func) | |
return OS.FeatureInfo( GetObject(item), func )[6] | |
end | |
function Dynamic GetParent(Dynamic item) | |
return OS.Parent( GetObject(item) ) | |
end | |
function Dynamic GetMethodFromParent(Dynamic item, String func) | |
return GetParent(item).(func) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment