Only call astScopeAllocLocals() under ast.doemit (fixes #644)

This prevents the AST emitting from trying to allocate (ASM backend) or
emit (C backend) scope locals from procedures that are being ignored,
i.e. unused PRIVATE ones, ast.doemit = FALSE.

Otherwise the C backend could end up emitting declarations for the local
vars even though it's not even emitting any surrounding proc body...
For the ASM backend it's not that much of a problem, because it just
reserves theoretical stack space and does not generate code yet, but
essentially it's the same issue.

This could happen with local vars declared by the user or with temp vars
allocated by the compiler. However, since 47644f88 user-declared locals
aren't emitted by astScopeAllocLocals() anymore and this problem was
hidden since that commit.

Even though it could still happen with temp vars, these have unique names
and thus wouldn't trigger a gcc error, and in fact not even a linking
error, because temp vars will never be emitted with initializers,
causing gcc to treat them as COMMONs which the linker will merge silently.
Only call irProcAllocStaticVars() under ast.doemit

For the ASM backend this caused static vars to be emitted even though their
parent proc never was.

For the C backend it's the same except that irProcAllocStaticVars() only
handles static vars with dtors, so normal statics are not affected.