2
0
Quellcode durchsuchen

Adds `Node >> size`, fixes #814

Nicolas Petton vor 11 Jahren
Ursprung
Commit
72b4d7bf64
2 geänderte Dateien mit 22 neuen und 0 gelöschten Zeilen
  1. 18 0
      js/Compiler-AST.js
  2. 4 0
      st/Compiler-AST.st

+ 18 - 0
js/Compiler-AST.js

@@ -608,6 +608,24 @@ referencedClasses: []
 }),
 globals.Node);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "size",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._source())._size();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"size",{},globals.Node)})},
+args: [],
+source: "size\x0a\x09^ self source size",
+messageSends: ["size", "source"],
+referencedClasses: []
+}),
+globals.Node);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "source",

+ 4 - 0
st/Compiler-AST.st

@@ -82,6 +82,10 @@ shouldBeInlined: aBoolean
 	shouldBeInlined := aBoolean
 !
 
+size
+	^ self source size
+!
+
 source
 	^ source ifNil: [ '' ]
 !