Procházet zdrojové kódy

Adds IRInstruction >> scope

Nicolas Petton před 10 roky
rodič
revize
c97fc2ef1e
2 změnil soubory, kde provedl 28 přidání a 0 odebrání
  1. 23 0
      js/Compiler-IR.js
  2. 5 0
      st/Compiler-IR.st

+ 23 - 0
js/Compiler-IR.js

@@ -1029,6 +1029,29 @@ referencedClasses: []
 }),
 smalltalk.IRInstruction);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "scope",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._parent();
+if(($receiver = $2) == nil || $receiver == null){
+$1=$2;
+} else {
+$1=_st(self["@parent"]).__or(_st(self["@parent"])._scope());
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"scope",{},smalltalk.IRInstruction)})},
+args: [],
+source: "scope\x0a\x09^ self parent ifNotNil: [ parent | \x0a\x09\x09parent scope ]",
+messageSends: ["ifNotNil:", "parent", "|", "scope"],
+referencedClasses: []
+}),
+smalltalk.IRInstruction);
+
 
 smalltalk.addMethod(
 smalltalk.method({

+ 5 - 0
st/Compiler-IR.st

@@ -273,6 +273,11 @@ parent
 
 parent: anIRInstruction
 	parent := anIRInstruction
+!
+
+scope
+	^ self parent ifNotNil: [ parent | 
+		parent scope ]
 ! !
 
 !IRInstruction methodsFor: 'building'!