Fix test 30068.
Fix a test
Fix test for error #30064.
Fix test for error #30074.
Emit local constants properly, and fix a few related tests.
Fix a test
Don't put addevent handlers in static constructors.