Closure operator now behaves as default argument operator, documentation.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@965 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-06-03 18:33:17 +00:00
parent c5159ebcf7
commit d00beeb55f
11 changed files with 182 additions and 60 deletions
+9 -1
View File
@@ -62,12 +62,20 @@ class Context {
ScriptValueP getVariable(Variable var);
/// Get the value of a variable, returns ScriptValue() if it is not set
inline ScriptValueP getVariableOpt(Variable var) { return variables[var].value; }
/// In what scope was the variable set?
/** Returns 0 for the current scope and >0 for outer scopes.
* Returns -1 if the varible is not set
*/
int getVariableScope(Variable var);
private:
/// Open a new scope
/** returns the number of shadowed binding before that scope */
size_t openScope();
/// Close a scope, must be passed a value from openScope
void closeScope(size_t scope);
friend class LocalScope;
public:// public for FOR_EACH
/// Record of a variable
@@ -102,7 +110,7 @@ class Context {
/// Make an object with n elements, popping 2n values from the stack, and push it onto the stack
void makeObject(size_t n);
/// Make a closure with n arguments
void makeClosure(size_t n);
void makeClosure(size_t n, const Instruction*& instr);
};
/// A class that creates a local scope