home *** CD-ROM | disk | FTP | other *** search
- public class JScriptMethod extends JScriptConstructor {
- private JScriptModule aParentModule;
- private boolean bModuleCodeFunction;
- private String aName;
- private JScriptCodeBlock aCodeBlock;
- private JScriptTokenPosition aSourceCodePos;
- private String[] aParameterList;
- private String[] aLocalVarList;
- public JSbxValueProperty[] aLocalVarPropBuffer;
- private JSbxVector aLocalVarVector;
- public boolean bHasLengthAsParam;
- public JScriptCallLevelInstance pPropUser;
- public JSbxObjectProperty[] aObjectPropBuffer;
- public JSbxValueProperty[] aValuePropBuffer;
-
- public JScriptModule GetModule() {
- return this.aParentModule;
- }
-
- public boolean IsModuleCodeFunction() {
- return this.bModuleCodeFunction;
- }
-
- public String GetName() {
- return this.aName;
- }
-
- public JScriptCodeBlock GetCodeBlock() {
- return this.aCodeBlock;
- }
-
- public void SetCodeBlock(JScriptCodeBlock var1) {
- this.aCodeBlock = var1;
- }
-
- public void SetSourceCodePos(JScriptTokenPosition var1) {
- this.aSourceCodePos = var1;
- }
-
- public String[] GetParameterList() {
- return this.aParameterList;
- }
-
- public String[] GetLocalVarList() {
- return this.aLocalVarList;
- }
-
- public JSbxVector GetLocalVarVector() {
- if (this.aLocalVarVector == null) {
- this.aLocalVarVector = new JSbxVector();
- }
-
- return this.aLocalVarVector;
- }
-
- public void LocalVarDefFinished() {
- if (this.aLocalVarVector != null) {
- int var1 = this.aLocalVarVector.GetSize();
- if (var1 > 0) {
- this.aLocalVarList = new String[var1];
- this.aLocalVarPropBuffer = new JSbxValueProperty[var1];
-
- for(int var2 = 0; var2 < var1; ++var2) {
- String var3 = (String)this.aLocalVarVector.Get(var2);
- this.aLocalVarList[var2] = var3;
- this.aLocalVarPropBuffer[var2] = new JSbxValueProperty(var3, this, (JSbxValue)null);
- }
- }
-
- this.aLocalVarVector = null;
- }
- }
-
- public void SetParameterList(String[] var1) {
- this.aParameterList = var1;
- this.bHasLengthAsParam = false;
- this.pPropUser = null;
- if (this.aParameterList != null) {
- int var2 = this.aParameterList.length;
- this.aObjectPropBuffer = new JSbxObjectProperty[var2];
- this.aValuePropBuffer = new JSbxValueProperty[var2];
-
- for(int var3 = 0; var3 < var2; ++var3) {
- if (this.aParameterList[var3].equals("length")) {
- this.bHasLengthAsParam = true;
- }
-
- this.aObjectPropBuffer[var3] = new JSbxObjectProperty(this.aParameterList[var3], this, (JSbxPropertyInterface)null, var3);
- this.aValuePropBuffer[var3] = new JSbxValueProperty(this.aParameterList[var3], this, (JSbxValue)null);
- }
- }
-
- }
-
- protected JScriptMethod(JScriptModule var1, String var2, JScriptConstructor var3) {
- this(var1, var2, new JScriptCodeBlock(), var3);
- this.bModuleCodeFunction = false;
- }
-
- public JScriptMethod(JScriptModule var1, String var2) {
- this(var1, var2, new JScriptCodeBlock(), (JScriptConstructor)null);
- this.bModuleCodeFunction = false;
- }
-
- public JScriptMethod(JScriptModule var1, JScriptCodeBlock var2) {
- this(var1, (String)null, var2, (JScriptConstructor)null);
- this.bModuleCodeFunction = true;
- }
-
- protected JScriptMethod(JScriptModule var1, String var2, JScriptCodeBlock var3, JScriptConstructor var4) {
- super(var4);
- this.aParentModule = var1;
- this.aName = var2;
- this.aCodeBlock = var3;
- this.aParameterList = null;
- this.aLocalVarList = null;
- }
-
- public JSbxValue CallFunction(JScriptCallParam var1) throws JSbxExceptionBase {
- var1.GetRuntimeParam().GetRuntimeInst().ExecuteFunction(this, var1);
- return var1.GetRuntimeParam().GetReturnValue();
- }
-
- public JSbxProperty Get(String var1, boolean var2) {
- if (!var2) {
- JScriptCallLevelInstance var3 = JScriptManager.GetMyActCallLevelInst();
- JSbxProperty var4 = var3 != null ? var3.GetLocalVarObject().Get(var1, false) : null;
- if (var4 != null) {
- return var4;
- }
- }
-
- return super.Get(var1, var2);
- }
-
- public JSbxProperty Get(int var1, boolean var2) {
- JScriptCallLevelInstance var3 = JScriptManager.GetMyActCallLevelInst();
- JScriptArgumentsObject var4 = var3.GetArgumentsObject();
- return var4 != null && var1 < var4.GetParamCount() && var3.GetMethod() == this ? ((JSbxObject)var3).Get(var1, false) : super.Get(var1, var2);
- }
-
- public String GetJScriptString(boolean var1) {
- return this.GetSourceCode();
- }
-
- private final String GetSourceCode() {
- String var1 = this.GetModule().GetSource();
- return var1.substring(this.aSourceCodePos.GetStartPos(), this.aSourceCodePos.GetEndPos());
- }
- }
-