コード例 #1
0
        private void ProcessExtCall(ScriptBuilder sb)
        {
            if (Arguments.Length != 1)
            {
                throw new CompilerException(LineNumber, ERR_INCORRECT_NUMBER);
            }

            if (Arguments[0].IsString())
            {
                var extCall = Arguments[0].AsString();

                if (string.IsNullOrEmpty(extCall))
                {
                    throw new CompilerException(LineNumber, ERR_INVALID_ARGUMENT);
                }

                sb.EmitExtCall(extCall);
            }
            else
            if (Arguments[0].IsRegister())
            {
                var reg = Arguments[0].AsRegister();
                sb.Emit(Opcode.EXTCALL, new byte[] { reg });
            }
            else
            {
                throw new CompilerException(LineNumber, ERR_INVALID_ARGUMENT);
            }
        }