internal void noticeWhenCreateAneFailed() { if (toNoticeFailed1 != null) { toNoticeFailed1.noticeRunFailed(); toNoticeFailed1 = null; } if (toNoticeFailed2 != null) { toNoticeFailed2.noticeRunFailed(); toNoticeFailed2 = null; } }
private static ASBinCode.rtData.rtObjectBase makeObj( Player player, SourceToken token, ASBinCode.rtti.Class cls, BlockCallBackBase callbacker,InstanceCreator creator,out ASBinCode.RunTimeScope objScope) { ASBinCode.rtData.rtObjectBase result; ASBinCode.rtData.rtObjectBase lr; string err; ASBinCode.rtti.Object obj = createObject(player.swc,cls,creator,out result,out lr,out err); if (obj == null) { objScope = null; if (callbacker != null) { callbacker.noticeRunFailed(); } player.throwWhenMakeObjFailed(new ASRunTimeException(err,player.stackTrace(0))); return(null); } if (result == null) { if (lr == null) { result = new ASBinCode.rtData.rtObject(obj,null); } else { result = lr; } if (cls.fields.Count > 0) { obj.memberData = new ObjectMemberSlot[cls.fields.Count]; for (int i = 0; i < obj.memberData.Length; i++) { obj.memberData[i] = new ObjectMemberSlot(result,player.swc.FunctionClass.getRtType(),cls.fields[i].valueType,player.swc); if (cls.fields[i].defaultValue == null) { obj.memberData[i].directSet(TypeConverter.getDefaultValue(cls.fields[i].valueType).getValue(null,null)); } ((ObjectMemberSlot)obj.memberData[i]).isConstMember = cls.fields[i].isConst; } } else { obj.memberData = blankFields; } ASBinCode.CodeBlock codeblock = player.swc.blocks[cls.blockid]; objScope = player.callBlock(codeblock, (ObjectMemberSlot[])obj.memberData,null, null ,token,callbacker , result,RunTimeScopeType.objectinstance ); result.objScope = objScope; if (objScope == null) { if (callbacker != null) { callbacker.noticeRunFailed(); } return(null); } //***把父类的初始化函数推到栈上去*** var ss = cls.super; while (ss != null) { var scope = player.callBlock(player.swc.blocks[ss.blockid], (ObjectMemberSlot[])obj.memberData, null,null,token,null,result,RunTimeScopeType.objectinstance ); ss = ss.super; if (scope == null) { if (callbacker != null) { callbacker.noticeRunFailed(); } return(null); } } } else { objScope = result.objScope; player.CallBlankBlock(callbacker); } if (callbacker != null) { //callbacker.obj = obj; //callbacker.rtObject = result; //callbacker.objScope = objScope; callbacker.cacheObjects[0] = obj; callbacker.cacheObjects[1] = result; callbacker.cacheObjects[2] = objScope; } return(result); }