ソースを参照

Adds `Node >> size`, fixes #814

Nicolas Petton 11 年 前
コミット
72b4d7bf64
2 ファイル変更22 行追加0 行削除
  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: [ '' ]
 !