Jelajahi Sumber

base context cleanup

Vladislav Folts 10 tahun lalu
induk
melakukan
6a4b004614
2 mengubah file dengan 19 tambahan dan 13 penghapusan
  1. TEMPAT SAMPAH
      bin/compiled.zip
  2. 19 13
      src/context.js

TEMPAT SAMPAH
bin/compiled.zip


+ 19 - 13
src/context.js

@@ -142,12 +142,9 @@ var ChainedContext = Class.extend({
     currentScope: function(s){return this.__parent.currentScope();},
     currentScope: function(s){return this.__parent.currentScope();},
     pushScope: function(scope){this.__parent.pushScope(scope);},
     pushScope: function(scope){this.__parent.pushScope(scope);},
     popScope: function(){this.__parent.popScope();},
     popScope: function(){this.__parent.popScope();},
-    setType: function(type){this.__parent.setType(type);},
-    handleExpression: function(e){this.__parent.handleExpression(e);},
+    qualifyScope: function(scope){return this.__parent.qualifyScope(scope);},
     handleLiteral: function(s){},
     handleLiteral: function(s){},
-    handleConst: function(type, value, code){this.__parent.handleConst(type, value, code);},
-    genTypeName: function(){return this.__parent.genTypeName();},
-    qualifyScope: function(scope){return this.__parent.qualifyScope(scope);}
+    genTypeName: function(){return this.__parent.genTypeName();}
 });
 });
 
 
 exports.Integer = ChainedContext.extend({
 exports.Integer = ChainedContext.extend({
@@ -1083,7 +1080,7 @@ exports.Term = ChainedContext.extend({
     },
     },
     handleLogicalNot: function(){
     handleLogicalNot: function(){
         this.__logicalNot = !this.__logicalNot;
         this.__logicalNot = !this.__logicalNot;
-        this.setType(basicTypes.bool);
+        this.parent().setType(basicTypes.bool);
     },
     },
     handleOperator: function(o){this.__operator = o;},
     handleOperator: function(o){this.__operator = o;},
     handleConst: function(type, value, code){
     handleConst: function(type, value, code){
@@ -1124,17 +1121,24 @@ exports.Factor = ChainedContext.extend({
     },
     },
     type: function(){return this.parent().type();},
     type: function(){return this.parent().type();},
     handleLiteral: function(s){
     handleLiteral: function(s){
-        var parent = this.parent();
         if (s == "NIL")
         if (s == "NIL")
-            parent.handleConst(nilType, undefined, "null");
+            this.handleConst(nilType, undefined, "null");
         else if (s == "TRUE")
         else if (s == "TRUE")
-            parent.handleConst(basicTypes.bool, Code.makeIntConst(1), "true");
+            this.handleConst(basicTypes.bool, Code.makeIntConst(1), "true");
         else if (s == "FALSE")
         else if (s == "FALSE")
-            parent.handleConst(basicTypes.bool, Code.makeIntConst(0), "false");
+            this.handleConst(basicTypes.bool, Code.makeIntConst(0), "false");
         else if (s == "~")
         else if (s == "~")
-            parent.handleLogicalNot();
+            this.parent().handleLogicalNot();
+    },
+    handleConst: function(type, value, code){
+        this.parent().handleConst(type, value, code);
+    },
+    handleFactor: function(e){
+        this.parent().handleFactor(e);
+    },
+    handleExpression: function(e){
+        this.parent().handleExpression(e);
     },
     },
-    handleFactor: function(e){this.parent().handleFactor(e);},
     handleLogicalNot: function(){this.parent().handleLogicalNot();}
     handleLogicalNot: function(){this.parent().handleLogicalNot();}
 });
 });
 
 
@@ -1733,7 +1737,9 @@ exports.ActualParameters = ChainedContext.extend({
         ChainedContext.prototype.init.call(this, context);
         ChainedContext.prototype.init.call(this, context);
         this.handleMessage(beginCallMsg);
         this.handleMessage(beginCallMsg);
     },
     },
-    handleLiteral: function(){}, // do not propagate ","
+    handleExpression: function(e){
+        this.parent().handleExpression(e);
+    },
     endParse: function(){
     endParse: function(){
         this.handleMessage(endCallMsg);
         this.handleMessage(endCallMsg);
     }
     }