Chainsaws use only a pre-mixed fuel that combines regular unleaded gasoline with specially blended two-cycle engine oil. These small engines, unlike your car, don't use an oil pump to lubricate the crankcase and piston. This lubrication comes directly from the fuel source, so never put straight gas into the chainsaw.
Don't Start the Engine
If you misread the instructions or just forgot and put straight, unmixed gas into the fuel tank, do not, for any reason, start the engine. If this fuel reaches the piston and crankcase it will not properly lubricate them and will cause almost instant damage. These engines run at incredibly high rates of speed---even higher than your car---sometimes in excess of 13,000 RPMs. Even 30 seconds at these speeds without lubrication is enough to damage your piston.
Flush the Tank
If you haven't started the engine, immediately drain the fuel tank. Pour out everything in the tank. Disconnect both the fuel lines, main and return, including the primer bulb, and remove them from the engine. Throw them away and replace them with new lines. Pour in a couple tablespoons of clean water into the tank, close the cap and swish it around to get out any unmixed fuel. If you've primed the engine or started it briefly, you'll need to remove and disassemble the carburettor and give it a thorough cleaning.
The End of Your Engine
If you ran the engine for even 30 seconds at full speed, your engine is likely done. If you started it, ran it and then had it die on you before realising your mistake, you have definitely ruined your engine. At this point, there is nothing you can do to fix it and would be better to scrap it for parts than trying to replace all of the parts you have fried.
When the unmixed fuel reaches the cylinder, it is ignited---like usual---by the spark plug. This fuel causes a higher combustion temperature and makes your engine run faster than its maximum operating speeds. These temperatures will quickly burn out the rings and seals around the piston; the piston will seize up inside the cylinder, shutting everything else down. The oil needs to lubricate the piston and crankcase to keep them from running hot and burning up.