1
0
Prechádzať zdrojové kódy

Adds `Node >> size`, fixes #814

Nicolas Petton 11 rokov pred
rodič
commit
72b4d7bf64
2 zmenil súbory, kde vykonal 22 pridanie a 0 odobranie
  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: [ '' ]
 !