1.1 --- a/jitcraft/BytecodeCompiler.cpp Mon Jun 25 21:20:01 2012 -0700
1.2 +++ b/jitcraft/BytecodeCompiler.cpp Tue Jun 26 00:35:15 2012 -0700
1.3 @@ -94,13 +94,26 @@
1.4 void
1.5 BytecodeCompiler::visit(NameProxy *name)
1.6 {
1.7 - Variable *var = name->binding()->toVariable();
1.8 + switch (name->binding()->kind()) {
1.9 + case BoundName::VARIABLE:
1.10 + {
1.11 + Variable *var = name->binding()->toVariable();
1.12
1.13 - if (var->location() == Variable::STACK) {
1.14 - __ getlocal(var->slot());
1.15 - } else {
1.16 - assert(var->location() == Variable::PARAMETER);
1.17 - __ getarg(var->slot());
1.18 + if (var->location() == Variable::STACK) {
1.19 + __ getlocal(var->slot());
1.20 + } else {
1.21 + assert(var->location() == Variable::PARAMETER);
1.22 + __ getarg(var->slot());
1.23 + }
1.24 + break;
1.25 + }
1.26 +
1.27 + default:
1.28 + {
1.29 + NamedConstant *constant = name->binding()->toNamedConstant();
1.30 + __ int_(constant->value().toInt());
1.31 + break;
1.32 + }
1.33 }
1.34 }
1.35
1.36 @@ -328,6 +341,12 @@
1.37 module_->setFunction(node->fun()->slot(), code);
1.38 }
1.39
1.40 +void
1.41 +BytecodeCompiler::visit(EnumStatement *node)
1.42 +{
1.43 + // :TODO: eventually, we'll export these.
1.44 +}
1.45 +
1.46 Code *
1.47 BytecodeCompiler::compileFunction(Module *module, FunctionStatement *node)
1.48 {