Yeah, I guess the use of the self keyword is pretty much absolute proof, isn't it? I wonder if using self makes sense to any procedure when invoked from within a method of a class, or whether it only makes sense to procedures that are part of the class, i.e. defined within the class, from whose method the procedure call originates. You guys probably know all this already from SCI development experience. Does SCI Studio and SCI Companion have support for procedures with calls to self?
Clearly it has support for this, since I just outlined three procedures in the template game that do this.
There are a number of opcodes that require a "class context" to be used. Any the of property set/get opcodes, self, super, selfID. The interpreter has a notion of the "current object", and it uses that to process these opcodes (actually, super may not require that, not sure). If a class method calls into a procedure, the "current object" is still that class.
Then, separate from that, is what is needed for compiling source code. The "self" keyword (which corresponds to the "self" opcode) actually doesn't need any context. i.e. to generate the bytecode for "self", I don't need to know what the class context is. So self can appear in any procedure (maybe I should make this an error? I forget if any template game code leverages this or not).
I can't generate bytecode for any of the property opcodes, or "super", without knowing what class this is for. Thus, when used in a procedure, that procedure must be marked as "belonging" to a class (like the 3 examples in the template game) or else it's a compile error.
As for codeblocks (I'm assuming you mean the code sections in the SCI0 script files?), I doubt it matters where things are physically located in the script resource. I certainly never paid any attention to it when writing the SCI Companion compiler. So I think it has no relevance whatsoever to whether or not a procedure is used within an object context. SCI1.1 uses the separate script/heap resources with a significantly changed format, and the notion of "code blocks" doesn't really exist anymore.