comparison cbackend.js @ 89:f23ecd4e22af

Remove some cruft from cbackend
author Mike Pavone <pavone@retrodev.com>
date Mon, 23 Jul 2012 07:59:34 -0700
parents 25bc8a5ab41e
children 926b65fe92b4
comparison
equal deleted inserted replaced
88:474f17ebaaa0 89:f23ecd4e22af
8 if (!(methodName in methodIds)) { 8 if (!(methodName in methodIds)) {
9 methodIds[methodName] = nextmethodId++; 9 methodIds[methodName] = nextmethodId++;
10 10
11 } 11 }
12 return methodIds[methodName]; 12 return methodIds[methodName];
13 }
14
15 function importSym(obj, src, key)
16 {
17 if(!(key in src)) {
18 throw new Error(key +' not found in source object for import');
19 }
20 if(key in obj) {
21 throw new Error(key +' already exists in target object for import')
22 }
23 obj[key] = src[key];
24 }
25
26 function doImport(obj, src, symlist)
27 {
28 if (symlist === undefined) {
29 each(src, function(key,val) {
30 if (key != 'parent') {
31 importSym(obj, src, key);
32 }
33 });
34 } else {
35 for (var i = 0; i < symlist.length; ++i) {
36 importSym(obj, src, symlist[i]);
37 }
38 }
39 return obj;
40 } 13 }
41 14
42 op.prototype.toC = function(isReceiver) { 15 op.prototype.toC = function(isReceiver) {
43 var optoMeth = {'+': 'ADD_', '-': 'SUB_', '*': 'MUL_', '/': 'DIV_', '%': 'MOD_', '=': 'EQ_', '!=': 'NEQ_', '<': 'LT_', '>': 'GT_', '>=': 'GEQ_', '<=': 'LEQ_', '.': 'CAT_'}; 16 var optoMeth = {'+': 'ADD_', '-': 'SUB_', '*': 'MUL_', '/': 'DIV_', '%': 'MOD_', '=': 'EQ_', '!=': 'NEQ_', '<': 'LT_', '>': 'GT_', '>=': 'GEQ_', '<=': 'LEQ_', '.': 'CAT_'};
44 var method = optoMeth[this.op]; 17 var method = optoMeth[this.op];