Browse Source

Compiler-* cleanup

Herbert Vojčík 8 years ago
parent
commit
d8c0f3f3c8

+ 1 - 0
local.amd.json

@@ -11,6 +11,7 @@
     "map": {
         "*": {
             "00comment": "These are backward compatibility pointers.",
+            "amber_core/Compiler-Exceptions": "amber_core/Compiler-Core",
             "amber_core/Kernel-ImportExport": "amber_core/Platform-ImportExport"
         }
     }

+ 416 - 178
src/Compiler-AST.js

@@ -534,110 +534,6 @@ messageSends: ["select:", "allNodes", "and:", "isNavigationNode", "inPosition:",
 }),
 $globals.Node);
 
-$core.addMethod(
-$core.method({
-selector: "nextChild",
-protocol: 'accessing',
-fn: function (){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $3,$2,$1;
-$3=self._nodes();
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.sendIdx["nodes"]=1;
-//>>excludeEnd("ctx");
-$2=$recv($3)._isEmpty();
-if($core.assert($2)){
-$1=self;
-} else {
-$1=$recv($recv(self._nodes())._first())._nextChild();
-};
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"nextChild",{},$globals.Node)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: [],
-source: "nextChild\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the receiver to answer the next node to be evaluated\x22\x0a\x09\x0a\x09^ self nodes isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self nodes first nextChild ]",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["ifTrue:ifFalse:", "isEmpty", "nodes", "nextChild", "first"]
-}),
-$globals.Node);
-
-$core.addMethod(
-$core.method({
-selector: "nextNode",
-protocol: 'accessing',
-fn: function (){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $2,$1,$receiver;
-$2=self._parent();
-if(($receiver = $2) == null || $receiver.isNil){
-$1=$2;
-} else {
-var node;
-node=$receiver;
-$1=$recv(node)._nextNode_(self);
-};
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"nextNode",{},$globals.Node)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: [],
-source: "nextNode\x0a\x09^ self parent ifNotNil: [ :node |\x0a\x09\x09node nextNode: self ]",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["ifNotNil:", "parent", "nextNode:"]
-}),
-$globals.Node);
-
-$core.addMethod(
-$core.method({
-selector: "nextNode:",
-protocol: 'accessing',
-fn: function (aNode){
-var self=this;
-var next;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1,$2;
-var $early={};
-try {
-$1=self._nodes();
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.sendIdx["nodes"]=1;
-//>>excludeEnd("ctx");
-next=$recv($1)._at_ifAbsent_($recv($recv(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
-throw $early=[self];
-
-}));
-$2=$recv(next)._nextChild();
-return $2;
-}
-catch(e) {if(e===$early)return e[0]; throw e}
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"nextNode:",{aNode:aNode,next:next},$globals.Node)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aNode"],
-source: "nextNode: aNode\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the next node to answer the next node to be evaluated\x22\x0a\x09\x0a\x09| next |\x0a\x09\x0a\x09next := self nodes \x0a\x09\x09at: (self nodes indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ ^ self ].\x0a\x09\x0a\x09^ next nextChild",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:", "nextChild"]
-}),
-$globals.Node);
-
 $core.addMethod(
 $core.method({
 selector: "nodes",
@@ -1114,24 +1010,6 @@ messageSends: []
 }),
 $globals.Node);
 
-$core.addMethod(
-$core.method({
-selector: "stopOnStepping",
-protocol: 'testing',
-fn: function (){
-var self=this;
-return false;
-
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: [],
-source: "stopOnStepping\x0a\x09^ false",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.Node);
-
 $core.addMethod(
 $core.method({
 selector: "subtreeNeedsAliasing",
@@ -1439,42 +1317,6 @@ messageSends: []
 }),
 $globals.BlockNode);
 
-$core.addMethod(
-$core.method({
-selector: "nextChild",
-protocol: 'accessing',
-fn: function (){
-var self=this;
-return self;
-
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: [],
-source: "nextChild\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.BlockNode);
-
-$core.addMethod(
-$core.method({
-selector: "nextNode:",
-protocol: 'accessing',
-fn: function (aNode){
-var self=this;
-return self;
-
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aNode"],
-source: "nextNode: aNode\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.BlockNode);
-
 $core.addMethod(
 $core.method({
 selector: "parameters",
@@ -2811,24 +2653,6 @@ messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shoul
 }),
 $globals.SendNode);
 
-$core.addMethod(
-$core.method({
-selector: "stopOnStepping",
-protocol: 'testing',
-fn: function (){
-var self=this;
-return true;
-
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: [],
-source: "stopOnStepping\x0a\x09^ true",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.SendNode);
-
 $core.addMethod(
 $core.method({
 selector: "superSend",
@@ -2881,7 +2705,7 @@ $globals.SendNode);
 $core.addMethod(
 $core.method({
 selector: "valueForReceiver:",
-protocol: 'accessing',
+protocol: 'building',
 fn: function (anObject){
 var self=this;
 function $SendNode(){return $globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
@@ -2955,7 +2779,7 @@ $globals.SequenceNode);
 $core.addMethod(
 $core.method({
 selector: "asBlockSequenceNode",
-protocol: 'converting',
+protocol: 'building',
 fn: function (){
 var self=this;
 function $BlockSequenceNode(){return $globals.BlockSequenceNode||(typeof BlockSequenceNode=="undefined"?nil:BlockSequenceNode)}
@@ -3533,6 +3357,420 @@ messageSends: ["value"]
 $globals.VariableNode);
 
 
+
+$core.addClass('NodeVisitor', $globals.Object, [], 'Compiler-AST');
+//>>excludeStart("ide", pragmas.excludeIdeData);
+$globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
+//>>excludeEnd("ide");
+$core.addMethod(
+$core.method({
+selector: "visit:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=$recv(aNode)._accept_(self);
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.NodeVisitor)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aNode"],
+source: "visit: aNode\x0a\x09^ aNode accept: self",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["accept:"]
+}),
+$globals.NodeVisitor);
+
+$core.addMethod(
+$core.method({
+selector: "visitAll:",
+protocol: 'visiting',
+fn: function (aCollection){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=$recv(aCollection)._collect_((function(each){
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx2) {
+//>>excludeEnd("ctx");
+return self._visit_(each);
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
+//>>excludeEnd("ctx");
+}));
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.NodeVisitor)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aCollection"],
+source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["collect:", "visit:"]
+}),
+$globals.NodeVisitor);
+
+$core.addMethod(
+$core.method({
+selector: "visitAssignmentNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aNode"],
+source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["visitNode:"]
+}),
+$globals.NodeVisitor);
+
+$core.addMethod(
+$core.method({
+selector: "visitBlockNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aNode"],
+source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["visitNode:"]
+}),
+$globals.NodeVisitor);
+
+$core.addMethod(
+$core.method({
+selector: "visitBlockSequenceNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=self._visitSequenceNode_(aNode);
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aNode"],
+source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["visitSequenceNode:"]
+}),
+$globals.NodeVisitor);
+
+$core.addMethod(
+$core.method({
+selector: "visitCascadeNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aNode"],
+source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["visitNode:"]
+}),
+$globals.NodeVisitor);
+
+$core.addMethod(
+$core.method({
+selector: "visitDynamicArrayNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aNode"],
+source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["visitNode:"]
+}),
+$globals.NodeVisitor);
+
+$core.addMethod(
+$core.method({
+selector: "visitDynamicDictionaryNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aNode"],
+source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["visitNode:"]
+}),
+$globals.NodeVisitor);
+
+$core.addMethod(
+$core.method({
+selector: "visitJSStatementNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aNode"],
+source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["visitNode:"]
+}),
+$globals.NodeVisitor);
+
+$core.addMethod(
+$core.method({
+selector: "visitMethodNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aNode"],
+source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["visitNode:"]
+}),
+$globals.NodeVisitor);
+
+$core.addMethod(
+$core.method({
+selector: "visitNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=self._visitAll_($recv(aNode)._nodes());
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},$globals.NodeVisitor)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aNode"],
+source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["visitAll:", "nodes"]
+}),
+$globals.NodeVisitor);
+
+$core.addMethod(
+$core.method({
+selector: "visitReturnNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aNode"],
+source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["visitNode:"]
+}),
+$globals.NodeVisitor);
+
+$core.addMethod(
+$core.method({
+selector: "visitSendNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aNode"],
+source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["visitNode:"]
+}),
+$globals.NodeVisitor);
+
+$core.addMethod(
+$core.method({
+selector: "visitSequenceNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aNode"],
+source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["visitNode:"]
+}),
+$globals.NodeVisitor);
+
+$core.addMethod(
+$core.method({
+selector: "visitValueNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aNode"],
+source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["visitNode:"]
+}),
+$globals.NodeVisitor);
+
+$core.addMethod(
+$core.method({
+selector: "visitVariableNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aNode"],
+source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["visitNode:"]
+}),
+$globals.NodeVisitor);
+
+
 $core.addMethod(
 $core.method({
 selector: "ast",

+ 76 - 49
src/Compiler-AST.st

@@ -48,33 +48,6 @@ navigationNodeAt: aPoint ifAbsent: aBlock
 		(b positionStart dist: aPoint) ]) first
 !
 
-nextChild
-	"Answer the next node after aNode.
-	Recurse into the possible children of the receiver to answer the next node to be evaluated"
-	
-	^ self nodes isEmpty
-		ifTrue: [ self ]
-		ifFalse: [ self nodes first nextChild ]
-!
-
-nextNode
-	^ self parent ifNotNil: [ :node |
-		node nextNode: self ]
-!
-
-nextNode: aNode
-	"Answer the next node after aNode.
-	Recurse into the possible children of the next node to answer the next node to be evaluated"
-	
-	| next |
-	
-	next := self nodes 
-		at: (self nodes indexOf: aNode) + 1
-		ifAbsent: [ ^ self ].
-	
-	^ next nextChild
-!
-
 nodes
 	^ nodes ifNil: [ nodes := Array new ]
 !
@@ -233,10 +206,6 @@ requiresSmalltalkContext
 		ifNone: [ nil ]) notNil
 !
 
-stopOnStepping
-	^ false
-!
-
 subtreeNeedsAliasing
 	^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [
 		self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]
@@ -302,18 +271,6 @@ I represent an block closure node.!
 
 !BlockNode methodsFor: 'accessing'!
 
-nextChild
-	"Answer the receiver as we want to avoid eager evaluation"
-	
-	^ self
-!
-
-nextNode: aNode
-	"Answer the receiver as we want to avoid eager evaluation"
-	
-	^ self
-!
-
 parameters
 	^ parameters ifNil: [ parameters := Array new ]
 !
@@ -612,7 +569,9 @@ superSend
 
 superSend: aBoolean
 	superSend := aBoolean
-!
+! !
+
+!SendNode methodsFor: 'building'!
 
 valueForReceiver: anObject
 	^ SendNode new
@@ -656,10 +615,6 @@ shouldBeAliased
 		self isReferenced and: [
 			(sends > 1 and: [ self index < sends ])
 				or: [ self superSend ] ] ])
-!
-
-stopOnStepping
-	^ true
 ! !
 
 !SendNode methodsFor: 'visiting'!
@@ -692,7 +647,7 @@ temps: aCollection
 	temps := aCollection
 ! !
 
-!SequenceNode methodsFor: 'converting'!
+!SequenceNode methodsFor: 'building'!
 
 asBlockSequenceNode
 	^ BlockSequenceNode new
@@ -826,6 +781,78 @@ accept: aVisitor
 	^ aVisitor visitVariableNode: self
 ! !
 
+Object subclass: #NodeVisitor
+	instanceVariableNames: ''
+	package: 'Compiler-AST'!
+!NodeVisitor commentStamp!
+I am the abstract super class of all AST node visitors.!
+
+!NodeVisitor methodsFor: 'visiting'!
+
+visit: aNode
+	^ aNode accept: self
+!
+
+visitAll: aCollection
+	^ aCollection collect: [ :each | self visit: each ]
+!
+
+visitAssignmentNode: aNode
+	^ self visitNode: aNode
+!
+
+visitBlockNode: aNode
+	^ self visitNode: aNode
+!
+
+visitBlockSequenceNode: aNode
+	^ self visitSequenceNode: aNode
+!
+
+visitCascadeNode: aNode
+	^ self visitNode: aNode
+!
+
+visitDynamicArrayNode: aNode
+	^ self visitNode: aNode
+!
+
+visitDynamicDictionaryNode: aNode
+	^ self visitNode: aNode
+!
+
+visitJSStatementNode: aNode
+	^ self visitNode: aNode
+!
+
+visitMethodNode: aNode
+	^ self visitNode: aNode
+!
+
+visitNode: aNode
+	^ self visitAll: aNode nodes
+!
+
+visitReturnNode: aNode
+	^ self visitNode: aNode
+!
+
+visitSendNode: aNode
+	^ self visitNode: aNode
+!
+
+visitSequenceNode: aNode
+	^ self visitNode: aNode
+!
+
+visitValueNode: aNode
+	^ self visitNode: aNode
+!
+
+visitVariableNode: aNode
+	^ self visitNode: aNode
+! !
+
 !CompiledMethod methodsFor: '*Compiler-AST'!
 
 ast

+ 7 - 415
src/Compiler-Core.js

@@ -1,4 +1,4 @@
-define("amber_core/Compiler-Core", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Platform-Services", "amber_core/Kernel-Collections"], function($boot){"use strict";
+define("amber_core/Compiler-Core", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Platform-Services", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Collections"], function($boot){"use strict";
 var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
 $core.addPackage('Compiler-Core');
 $core.packages["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
@@ -1015,6 +1015,12 @@ messageSends: ["do:", "classes", "recompile:"]
 $globals.Compiler.klass);
 
 
+$core.addClass('CompilerError', $globals.Error, [], 'Compiler-Core');
+//>>excludeStart("ide", pragmas.excludeIdeData);
+$globals.CompilerError.comment="I am the common superclass of all compiling errors.";
+//>>excludeEnd("ide");
+
+
 $core.addClass('DoIt', $globals.Object, [], 'Compiler-Core');
 //>>excludeStart("ide", pragmas.excludeIdeData);
 $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
@@ -1183,420 +1189,6 @@ messageSends: ["evaluate:for:", "new"]
 }),
 $globals.Evaluator.klass);
 
-
-$core.addClass('NodeVisitor', $globals.Object, [], 'Compiler-Core');
-//>>excludeStart("ide", pragmas.excludeIdeData);
-$globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
-//>>excludeEnd("ide");
-$core.addMethod(
-$core.method({
-selector: "visit:",
-protocol: 'visiting',
-fn: function (aNode){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-$1=$recv(aNode)._accept_(self);
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.NodeVisitor)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aNode"],
-source: "visit: aNode\x0a\x09^ aNode accept: self",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["accept:"]
-}),
-$globals.NodeVisitor);
-
-$core.addMethod(
-$core.method({
-selector: "visitAll:",
-protocol: 'visiting',
-fn: function (aCollection){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-$1=$recv(aCollection)._collect_((function(each){
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx2) {
-//>>excludeEnd("ctx");
-return self._visit_(each);
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
-//>>excludeEnd("ctx");
-}));
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.NodeVisitor)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aCollection"],
-source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["collect:", "visit:"]
-}),
-$globals.NodeVisitor);
-
-$core.addMethod(
-$core.method({
-selector: "visitAssignmentNode:",
-protocol: 'visiting',
-fn: function (aNode){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-$1=self._visitNode_(aNode);
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aNode"],
-source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["visitNode:"]
-}),
-$globals.NodeVisitor);
-
-$core.addMethod(
-$core.method({
-selector: "visitBlockNode:",
-protocol: 'visiting',
-fn: function (aNode){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-$1=self._visitNode_(aNode);
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aNode"],
-source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["visitNode:"]
-}),
-$globals.NodeVisitor);
-
-$core.addMethod(
-$core.method({
-selector: "visitBlockSequenceNode:",
-protocol: 'visiting',
-fn: function (aNode){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-$1=self._visitSequenceNode_(aNode);
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aNode"],
-source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["visitSequenceNode:"]
-}),
-$globals.NodeVisitor);
-
-$core.addMethod(
-$core.method({
-selector: "visitCascadeNode:",
-protocol: 'visiting',
-fn: function (aNode){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-$1=self._visitNode_(aNode);
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aNode"],
-source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["visitNode:"]
-}),
-$globals.NodeVisitor);
-
-$core.addMethod(
-$core.method({
-selector: "visitDynamicArrayNode:",
-protocol: 'visiting',
-fn: function (aNode){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-$1=self._visitNode_(aNode);
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aNode"],
-source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["visitNode:"]
-}),
-$globals.NodeVisitor);
-
-$core.addMethod(
-$core.method({
-selector: "visitDynamicDictionaryNode:",
-protocol: 'visiting',
-fn: function (aNode){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-$1=self._visitNode_(aNode);
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aNode"],
-source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["visitNode:"]
-}),
-$globals.NodeVisitor);
-
-$core.addMethod(
-$core.method({
-selector: "visitJSStatementNode:",
-protocol: 'visiting',
-fn: function (aNode){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-$1=self._visitNode_(aNode);
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aNode"],
-source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["visitNode:"]
-}),
-$globals.NodeVisitor);
-
-$core.addMethod(
-$core.method({
-selector: "visitMethodNode:",
-protocol: 'visiting',
-fn: function (aNode){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-$1=self._visitNode_(aNode);
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aNode"],
-source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["visitNode:"]
-}),
-$globals.NodeVisitor);
-
-$core.addMethod(
-$core.method({
-selector: "visitNode:",
-protocol: 'visiting',
-fn: function (aNode){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-$1=self._visitAll_($recv(aNode)._nodes());
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},$globals.NodeVisitor)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aNode"],
-source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["visitAll:", "nodes"]
-}),
-$globals.NodeVisitor);
-
-$core.addMethod(
-$core.method({
-selector: "visitReturnNode:",
-protocol: 'visiting',
-fn: function (aNode){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-$1=self._visitNode_(aNode);
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aNode"],
-source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["visitNode:"]
-}),
-$globals.NodeVisitor);
-
-$core.addMethod(
-$core.method({
-selector: "visitSendNode:",
-protocol: 'visiting',
-fn: function (aNode){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-$1=self._visitNode_(aNode);
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aNode"],
-source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["visitNode:"]
-}),
-$globals.NodeVisitor);
-
-$core.addMethod(
-$core.method({
-selector: "visitSequenceNode:",
-protocol: 'visiting',
-fn: function (aNode){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-$1=self._visitNode_(aNode);
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aNode"],
-source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["visitNode:"]
-}),
-$globals.NodeVisitor);
-
-$core.addMethod(
-$core.method({
-selector: "visitValueNode:",
-protocol: 'visiting',
-fn: function (aNode){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-$1=self._visitNode_(aNode);
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aNode"],
-source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["visitNode:"]
-}),
-$globals.NodeVisitor);
-
-$core.addMethod(
-$core.method({
-selector: "visitVariableNode:",
-protocol: 'visiting',
-fn: function (aNode){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-$1=self._visitNode_(aNode);
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aNode"],
-source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["visitNode:"]
-}),
-$globals.NodeVisitor);
-
-
 $core.addMethod(
 $core.method({
 selector: "asVariableName",

+ 6 - 72
src/Compiler-Core.st

@@ -246,6 +246,12 @@ recompileAll
 		self recompile: each ]
 ! !
 
+Error subclass: #CompilerError
+	instanceVariableNames: ''
+	package: 'Compiler-Core'!
+!CompilerError commentStamp!
+I am the common superclass of all compiling errors.!
+
 Object subclass: #DoIt
 	instanceVariableNames: ''
 	package: 'Compiler-Core'!
@@ -300,78 +306,6 @@ evaluate: aString for: anObject
 	^ self new evaluate: aString for: anObject
 ! !
 
-Object subclass: #NodeVisitor
-	instanceVariableNames: ''
-	package: 'Compiler-Core'!
-!NodeVisitor commentStamp!
-I am the abstract super class of all AST node visitors.!
-
-!NodeVisitor methodsFor: 'visiting'!
-
-visit: aNode
-	^ aNode accept: self
-!
-
-visitAll: aCollection
-	^ aCollection collect: [ :each | self visit: each ]
-!
-
-visitAssignmentNode: aNode
-	^ self visitNode: aNode
-!
-
-visitBlockNode: aNode
-	^ self visitNode: aNode
-!
-
-visitBlockSequenceNode: aNode
-	^ self visitSequenceNode: aNode
-!
-
-visitCascadeNode: aNode
-	^ self visitNode: aNode
-!
-
-visitDynamicArrayNode: aNode
-	^ self visitNode: aNode
-!
-
-visitDynamicDictionaryNode: aNode
-	^ self visitNode: aNode
-!
-
-visitJSStatementNode: aNode
-	^ self visitNode: aNode
-!
-
-visitMethodNode: aNode
-	^ self visitNode: aNode
-!
-
-visitNode: aNode
-	^ self visitAll: aNode nodes
-!
-
-visitReturnNode: aNode
-	^ self visitNode: aNode
-!
-
-visitSendNode: aNode
-	^ self visitNode: aNode
-!
-
-visitSequenceNode: aNode
-	^ self visitNode: aNode
-!
-
-visitValueNode: aNode
-	^ self visitNode: aNode
-!
-
-visitVariableNode: aNode
-	^ self visitNode: aNode
-! !
-
 !String methodsFor: '*Compiler-Core'!
 
 asVariableName

+ 0 - 300
src/Compiler-Exceptions.js

@@ -1,300 +0,0 @@
-define("amber_core/Compiler-Exceptions", ["amber/boot", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){"use strict";
-var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
-$core.addPackage('Compiler-Exceptions');
-$core.packages["Compiler-Exceptions"].innerEval = function (expr) { return eval(expr); };
-$core.packages["Compiler-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
-
-$core.addClass('CompilerError', $globals.Error, [], 'Compiler-Exceptions');
-//>>excludeStart("ide", pragmas.excludeIdeData);
-$globals.CompilerError.comment="I am the common superclass of all compiling errors.";
-//>>excludeEnd("ide");
-
-
-$core.addClass('ParseError', $globals.CompilerError, [], 'Compiler-Exceptions');
-//>>excludeStart("ide", pragmas.excludeIdeData);
-$globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
-//>>excludeEnd("ide");
-
-
-$core.addClass('SemanticError', $globals.CompilerError, [], 'Compiler-Exceptions');
-//>>excludeStart("ide", pragmas.excludeIdeData);
-$globals.SemanticError.comment="I represent an abstract semantic error thrown by the SemanticAnalyzer.\x0aSemantic errors can be unknown variable errors, etc.\x0aSee my subclasses for concrete errors.\x0a\x0aThe IDE should catch instances of Semantic error to deal with them when compiling";
-//>>excludeEnd("ide");
-
-
-$core.addClass('InliningError', $globals.SemanticError, [], 'Compiler-Exceptions');
-//>>excludeStart("ide", pragmas.excludeIdeData);
-$globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
-//>>excludeEnd("ide");
-
-
-$core.addClass('InvalidAssignmentError', $globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
-//>>excludeStart("ide", pragmas.excludeIdeData);
-$globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
-//>>excludeEnd("ide");
-$core.addMethod(
-$core.method({
-selector: "messageText",
-protocol: 'accessing',
-fn: function (){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-$1=" Invalid assignment to variable: ".__comma(self._variableName());
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: [],
-source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: [",", "variableName"]
-}),
-$globals.InvalidAssignmentError);
-
-$core.addMethod(
-$core.method({
-selector: "variableName",
-protocol: 'accessing',
-fn: function (){
-var self=this;
-var $1;
-$1=self["@variableName"];
-return $1;
-
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: [],
-source: "variableName\x0a\x09^ variableName",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.InvalidAssignmentError);
-
-$core.addMethod(
-$core.method({
-selector: "variableName:",
-protocol: 'accessing',
-fn: function (aString){
-var self=this;
-self["@variableName"]=aString;
-return self;
-
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aString"],
-source: "variableName: aString\x0a\x09variableName := aString",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.InvalidAssignmentError);
-
-
-
-$core.addClass('ShadowingVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
-//>>excludeStart("ide", pragmas.excludeIdeData);
-$globals.ShadowingVariableError.comment="I get signaled when a variable in a block or method scope shadows a variable of the same name in an outer scope.";
-//>>excludeEnd("ide");
-$core.addMethod(
-$core.method({
-selector: "messageText",
-protocol: 'accessing',
-fn: function (){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-$1=$recv("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.sendIdx[","]=1;
-//>>excludeEnd("ctx");
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: [],
-source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: [",", "variableName"]
-}),
-$globals.ShadowingVariableError);
-
-$core.addMethod(
-$core.method({
-selector: "variableName",
-protocol: 'accessing',
-fn: function (){
-var self=this;
-var $1;
-$1=self["@variableName"];
-return $1;
-
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: [],
-source: "variableName\x0a\x09^ variableName",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.ShadowingVariableError);
-
-$core.addMethod(
-$core.method({
-selector: "variableName:",
-protocol: 'accessing',
-fn: function (aString){
-var self=this;
-self["@variableName"]=aString;
-return self;
-
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aString"],
-source: "variableName: aString\x0a\x09variableName := aString",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.ShadowingVariableError);
-
-
-
-$core.addClass('UnknownVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
-//>>excludeStart("ide", pragmas.excludeIdeData);
-$globals.UnknownVariableError.comment="I get signaled when a variable is not defined.\x0aThe default behavior is to allow it, as this is how Amber currently is able to seamlessly send messages to JavaScript objects.";
-//>>excludeEnd("ide");
-$core.addMethod(
-$core.method({
-selector: "messageText",
-protocol: 'accessing',
-fn: function (){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-$1=$recv("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.sendIdx[","]=1;
-//>>excludeEnd("ctx");
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: [],
-source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: [",", "variableName"]
-}),
-$globals.UnknownVariableError);
-
-$core.addMethod(
-$core.method({
-selector: "variableName",
-protocol: 'accessing',
-fn: function (){
-var self=this;
-var $1;
-$1=self["@variableName"];
-return $1;
-
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: [],
-source: "variableName\x0a\x09^ variableName",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.UnknownVariableError);
-
-$core.addMethod(
-$core.method({
-selector: "variableName:",
-protocol: 'accessing',
-fn: function (aString){
-var self=this;
-self["@variableName"]=aString;
-return self;
-
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aString"],
-source: "variableName: aString\x0a\x09variableName := aString",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.UnknownVariableError);
-
-
-
-$core.addClass('RethrowErrorHandler', $globals.Object, [], 'Compiler-Exceptions');
-//>>excludeStart("ide", pragmas.excludeIdeData);
-$globals.RethrowErrorHandler.comment="This class is used in the commandline version of the compiler.\x0aIt uses the handleError: message of ErrorHandler for printing the stacktrace and throws the error again as JS exception.\x0aAs a result Smalltalk errors are not swallowd by the Amber runtime and compilation can be aborted.";
-//>>excludeEnd("ide");
-$core.addMethod(
-$core.method({
-selector: "basicSignal:",
-protocol: 'error handling',
-fn: function (anError){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-throw anError;
-return self;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},$globals.RethrowErrorHandler)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["anError"],
-source: "basicSignal: anError\x0a        <throw anError>",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.RethrowErrorHandler);
-
-$core.addMethod(
-$core.method({
-selector: "handleError:",
-protocol: 'error handling',
-fn: function (anError){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-self._basicSignal_(anError);
-return self;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.RethrowErrorHandler)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["anError"],
-source: "handleError: anError\x0a        self basicSignal: anError",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["basicSignal:"]
-}),
-$globals.RethrowErrorHandler);
-
-
-});

+ 0 - 109
src/Compiler-Exceptions.st

@@ -1,109 +0,0 @@
-Smalltalk createPackage: 'Compiler-Exceptions'!
-Error subclass: #CompilerError
-	instanceVariableNames: ''
-	package: 'Compiler-Exceptions'!
-!CompilerError commentStamp!
-I am the common superclass of all compiling errors.!
-
-CompilerError subclass: #ParseError
-	instanceVariableNames: ''
-	package: 'Compiler-Exceptions'!
-!ParseError commentStamp!
-Instance of ParseError are signaled on any parsing error.
-See `Smalltalk >> #parse:`!
-
-CompilerError subclass: #SemanticError
-	instanceVariableNames: ''
-	package: 'Compiler-Exceptions'!
-!SemanticError commentStamp!
-I represent an abstract semantic error thrown by the SemanticAnalyzer.
-Semantic errors can be unknown variable errors, etc.
-See my subclasses for concrete errors.
-
-The IDE should catch instances of Semantic error to deal with them when compiling!
-
-SemanticError subclass: #InliningError
-	instanceVariableNames: ''
-	package: 'Compiler-Exceptions'!
-!InliningError commentStamp!
-Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.!
-
-SemanticError subclass: #InvalidAssignmentError
-	instanceVariableNames: 'variableName'
-	package: 'Compiler-Exceptions'!
-!InvalidAssignmentError commentStamp!
-I get signaled when a pseudo variable gets assigned.!
-
-!InvalidAssignmentError methodsFor: 'accessing'!
-
-messageText
-	^ ' Invalid assignment to variable: ', self variableName
-!
-
-variableName
-	^ variableName
-!
-
-variableName: aString
-	variableName := aString
-! !
-
-SemanticError subclass: #ShadowingVariableError
-	instanceVariableNames: 'variableName'
-	package: 'Compiler-Exceptions'!
-!ShadowingVariableError commentStamp!
-I get signaled when a variable in a block or method scope shadows a variable of the same name in an outer scope.!
-
-!ShadowingVariableError methodsFor: 'accessing'!
-
-messageText
-	^ 'Variable shadowing error: ', self variableName, ' is already defined'
-!
-
-variableName
-	^ variableName
-!
-
-variableName: aString
-	variableName := aString
-! !
-
-SemanticError subclass: #UnknownVariableError
-	instanceVariableNames: 'variableName'
-	package: 'Compiler-Exceptions'!
-!UnknownVariableError commentStamp!
-I get signaled when a variable is not defined.
-The default behavior is to allow it, as this is how Amber currently is able to seamlessly send messages to JavaScript objects.!
-
-!UnknownVariableError methodsFor: 'accessing'!
-
-messageText
-	^ 'Unknown Variable error: ', self variableName, ' is not defined'
-!
-
-variableName
-	^ variableName
-!
-
-variableName: aString
-	variableName := aString
-! !
-
-Object subclass: #RethrowErrorHandler
-	instanceVariableNames: ''
-	package: 'Compiler-Exceptions'!
-!RethrowErrorHandler commentStamp!
-This class is used in the commandline version of the compiler.
-It uses the handleError: message of ErrorHandler for printing the stacktrace and throws the error again as JS exception.
-As a result Smalltalk errors are not swallowd by the Amber runtime and compilation can be aborted.!
-
-!RethrowErrorHandler methodsFor: 'error handling'!
-
-basicSignal: anError
-        <throw anError>
-!
-
-handleError: anError
-        self basicSignal: anError
-! !
-

+ 1 - 1
src/Compiler-IR.js

@@ -1,4 +1,4 @@
-define("amber_core/Compiler-IR", ["amber/boot", "amber_core/Compiler-Core", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){"use strict";
+define("amber_core/Compiler-IR", ["amber/boot", "amber_core/Compiler-AST", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){"use strict";
 var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
 $core.addPackage('Compiler-IR');
 $core.packages["Compiler-IR"].innerEval = function (expr) { return eval(expr); };

+ 7 - 1
src/Compiler-Inlining.js

@@ -1,4 +1,4 @@
-define("amber_core/Compiler-Inlining", ["amber/boot", "amber_core/Compiler-IR", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function($boot){"use strict";
+define("amber_core/Compiler-Inlining", ["amber/boot", "amber_core/Compiler-IR", "amber_core/Kernel-Objects", "amber_core/Compiler-Core", "amber_core/Compiler-Semantic"], function($boot){"use strict";
 var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
 $core.addPackage('Compiler-Inlining');
 $core.packages["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
@@ -2615,4 +2615,10 @@ messageSends: ["new"]
 $globals.InliningCodeGenerator);
 
 
+
+$core.addClass('InliningError', $globals.SemanticError, [], 'Compiler-Inlining');
+//>>excludeStart("ide", pragmas.excludeIdeData);
+$globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
+//>>excludeEnd("ide");
+
 });

+ 6 - 0
src/Compiler-Inlining.st

@@ -632,3 +632,9 @@ irTranslator
 	^ IRInliningJSTranslator new
 ! !
 
+SemanticError subclass: #InliningError
+	instanceVariableNames: ''
+	package: 'Compiler-Inlining'!
+!InliningError commentStamp!
+Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.!
+

+ 141 - 1
src/Compiler-Interpreter.js

@@ -1,4 +1,4 @@
-define("amber_core/Compiler-Interpreter", ["amber/boot", "amber_core/Kernel-Methods", "amber_core/Compiler-Semantic", "amber_core/Kernel-Objects", "amber_core/Compiler-Core", "amber_core/Kernel-Exceptions", "amber_core/Compiler-AST"], function($boot){"use strict";
+define("amber_core/Compiler-Interpreter", ["amber/boot", "amber_core/Kernel-Methods", "amber_core/Compiler-Semantic", "amber_core/Kernel-Objects", "amber_core/Compiler-AST", "amber_core/Kernel-Exceptions"], function($boot){"use strict";
 var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
 $core.addPackage('Compiler-Interpreter');
 $core.packages["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
@@ -3770,6 +3770,42 @@ messageSends: []
 }),
 $globals.BlockNode);
 
+$core.addMethod(
+$core.method({
+selector: "nextChild",
+protocol: '*Compiler-Interpreter',
+fn: function (){
+var self=this;
+return self;
+
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "nextChild\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: []
+}),
+$globals.BlockNode);
+
+$core.addMethod(
+$core.method({
+selector: "nextNode:",
+protocol: '*Compiler-Interpreter',
+fn: function (aNode){
+var self=this;
+return self;
+
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aNode"],
+source: "nextNode: aNode\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: []
+}),
+$globals.BlockNode);
+
 $core.addMethod(
 $core.method({
 selector: "isSteppingNode",
@@ -3842,6 +3878,110 @@ messageSends: []
 }),
 $globals.Node);
 
+$core.addMethod(
+$core.method({
+selector: "nextChild",
+protocol: '*Compiler-Interpreter',
+fn: function (){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $3,$2,$1;
+$3=self._nodes();
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.sendIdx["nodes"]=1;
+//>>excludeEnd("ctx");
+$2=$recv($3)._isEmpty();
+if($core.assert($2)){
+$1=self;
+} else {
+$1=$recv($recv(self._nodes())._first())._nextChild();
+};
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"nextChild",{},$globals.Node)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "nextChild\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the receiver to answer the next node to be evaluated\x22\x0a\x09\x0a\x09^ self nodes isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self nodes first nextChild ]",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["ifTrue:ifFalse:", "isEmpty", "nodes", "nextChild", "first"]
+}),
+$globals.Node);
+
+$core.addMethod(
+$core.method({
+selector: "nextNode",
+protocol: '*Compiler-Interpreter',
+fn: function (){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $2,$1,$receiver;
+$2=self._parent();
+if(($receiver = $2) == null || $receiver.isNil){
+$1=$2;
+} else {
+var node;
+node=$receiver;
+$1=$recv(node)._nextNode_(self);
+};
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"nextNode",{},$globals.Node)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "nextNode\x0a\x09^ self parent ifNotNil: [ :node |\x0a\x09\x09node nextNode: self ]",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["ifNotNil:", "parent", "nextNode:"]
+}),
+$globals.Node);
+
+$core.addMethod(
+$core.method({
+selector: "nextNode:",
+protocol: '*Compiler-Interpreter',
+fn: function (aNode){
+var self=this;
+var next;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1,$2;
+var $early={};
+try {
+$1=self._nodes();
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.sendIdx["nodes"]=1;
+//>>excludeEnd("ctx");
+next=$recv($1)._at_ifAbsent_($recv($recv(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
+throw $early=[self];
+
+}));
+$2=$recv(next)._nextChild();
+return $2;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"nextNode:",{aNode:aNode,next:next},$globals.Node)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aNode"],
+source: "nextNode: aNode\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the next node to answer the next node to be evaluated\x22\x0a\x09\x0a\x09| next |\x0a\x09\x0a\x09next := self nodes \x0a\x09\x09at: (self nodes indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ ^ self ].\x0a\x09\x0a\x09^ next nextChild",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:", "nextChild"]
+}),
+$globals.Node);
+
 $core.addMethod(
 $core.method({
 selector: "isSteppingNode",

+ 39 - 0
src/Compiler-Interpreter.st

@@ -941,6 +941,18 @@ isSteppingNode
 
 isSteppingNode
 	^ true
+!
+
+nextChild
+	"Answer the receiver as we want to avoid eager evaluation"
+	
+	^ self
+!
+
+nextNode: aNode
+	"Answer the receiver as we want to avoid eager evaluation"
+	
+	^ self
 ! !
 
 !DynamicArrayNode methodsFor: '*Compiler-Interpreter'!
@@ -965,6 +977,33 @@ isSteppingNode
 
 isSteppingNode
 	^ false
+!
+
+nextChild
+	"Answer the next node after aNode.
+	Recurse into the possible children of the receiver to answer the next node to be evaluated"
+	
+	^ self nodes isEmpty
+		ifTrue: [ self ]
+		ifFalse: [ self nodes first nextChild ]
+!
+
+nextNode
+	^ self parent ifNotNil: [ :node |
+		node nextNode: self ]
+!
+
+nextNode: aNode
+	"Answer the next node after aNode.
+	Recurse into the possible children of the next node to answer the next node to be evaluated"
+	
+	| next |
+	
+	next := self nodes 
+		at: (self nodes indexOf: aNode) + 1
+		ifAbsent: [ ^ self ].
+	
+	^ next nextChild
 ! !
 
 !SendNode methodsFor: '*Compiler-Interpreter'!

+ 223 - 1
src/Compiler-Semantic.js

@@ -1,4 +1,4 @@
-define("amber_core/Compiler-Semantic", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function($boot){"use strict";
+define("amber_core/Compiler-Semantic", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Compiler-AST", "amber_core/Compiler-Core"], function($boot){"use strict";
 var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
 $core.addPackage('Compiler-Semantic');
 $core.packages["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
@@ -2762,4 +2762,226 @@ messageSends: ["theClass:", "new", "yourself"]
 }),
 $globals.SemanticAnalyzer.klass);
 
+
+$core.addClass('SemanticError', $globals.CompilerError, [], 'Compiler-Semantic');
+//>>excludeStart("ide", pragmas.excludeIdeData);
+$globals.SemanticError.comment="I represent an abstract semantic error thrown by the SemanticAnalyzer.\x0aSemantic errors can be unknown variable errors, etc.\x0aSee my subclasses for concrete errors.\x0a\x0aThe IDE should catch instances of Semantic error to deal with them when compiling";
+//>>excludeEnd("ide");
+
+
+$core.addClass('InvalidAssignmentError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
+//>>excludeStart("ide", pragmas.excludeIdeData);
+$globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
+//>>excludeEnd("ide");
+$core.addMethod(
+$core.method({
+selector: "messageText",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=" Invalid assignment to variable: ".__comma(self._variableName());
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: [",", "variableName"]
+}),
+$globals.InvalidAssignmentError);
+
+$core.addMethod(
+$core.method({
+selector: "variableName",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@variableName"];
+return $1;
+
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "variableName\x0a\x09^ variableName",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: []
+}),
+$globals.InvalidAssignmentError);
+
+$core.addMethod(
+$core.method({
+selector: "variableName:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@variableName"]=aString;
+return self;
+
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aString"],
+source: "variableName: aString\x0a\x09variableName := aString",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: []
+}),
+$globals.InvalidAssignmentError);
+
+
+
+$core.addClass('ShadowingVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
+//>>excludeStart("ide", pragmas.excludeIdeData);
+$globals.ShadowingVariableError.comment="I get signaled when a variable in a block or method scope shadows a variable of the same name in an outer scope.";
+//>>excludeEnd("ide");
+$core.addMethod(
+$core.method({
+selector: "messageText",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=$recv("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.sendIdx[","]=1;
+//>>excludeEnd("ctx");
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: [",", "variableName"]
+}),
+$globals.ShadowingVariableError);
+
+$core.addMethod(
+$core.method({
+selector: "variableName",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@variableName"];
+return $1;
+
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "variableName\x0a\x09^ variableName",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: []
+}),
+$globals.ShadowingVariableError);
+
+$core.addMethod(
+$core.method({
+selector: "variableName:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@variableName"]=aString;
+return self;
+
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aString"],
+source: "variableName: aString\x0a\x09variableName := aString",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: []
+}),
+$globals.ShadowingVariableError);
+
+
+
+$core.addClass('UnknownVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
+//>>excludeStart("ide", pragmas.excludeIdeData);
+$globals.UnknownVariableError.comment="I get signaled when a variable is not defined.\x0aThe default behavior is to allow it, as this is how Amber currently is able to seamlessly send messages to JavaScript objects.";
+//>>excludeEnd("ide");
+$core.addMethod(
+$core.method({
+selector: "messageText",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=$recv("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.sendIdx[","]=1;
+//>>excludeEnd("ctx");
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: [",", "variableName"]
+}),
+$globals.UnknownVariableError);
+
+$core.addMethod(
+$core.method({
+selector: "variableName",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@variableName"];
+return $1;
+
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "variableName\x0a\x09^ variableName",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: []
+}),
+$globals.UnknownVariableError);
+
+$core.addMethod(
+$core.method({
+selector: "variableName:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@variableName"]=aString;
+return self;
+
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aString"],
+source: "variableName: aString\x0a\x09variableName := aString",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: []
+}),
+$globals.UnknownVariableError);
+
+
 });

+ 71 - 0
src/Compiler-Semantic.st

@@ -638,3 +638,74 @@ on: aClass
 		yourself
 ! !
 
+CompilerError subclass: #SemanticError
+	instanceVariableNames: ''
+	package: 'Compiler-Semantic'!
+!SemanticError commentStamp!
+I represent an abstract semantic error thrown by the SemanticAnalyzer.
+Semantic errors can be unknown variable errors, etc.
+See my subclasses for concrete errors.
+
+The IDE should catch instances of Semantic error to deal with them when compiling!
+
+SemanticError subclass: #InvalidAssignmentError
+	instanceVariableNames: 'variableName'
+	package: 'Compiler-Semantic'!
+!InvalidAssignmentError commentStamp!
+I get signaled when a pseudo variable gets assigned.!
+
+!InvalidAssignmentError methodsFor: 'accessing'!
+
+messageText
+	^ ' Invalid assignment to variable: ', self variableName
+!
+
+variableName
+	^ variableName
+!
+
+variableName: aString
+	variableName := aString
+! !
+
+SemanticError subclass: #ShadowingVariableError
+	instanceVariableNames: 'variableName'
+	package: 'Compiler-Semantic'!
+!ShadowingVariableError commentStamp!
+I get signaled when a variable in a block or method scope shadows a variable of the same name in an outer scope.!
+
+!ShadowingVariableError methodsFor: 'accessing'!
+
+messageText
+	^ 'Variable shadowing error: ', self variableName, ' is already defined'
+!
+
+variableName
+	^ variableName
+!
+
+variableName: aString
+	variableName := aString
+! !
+
+SemanticError subclass: #UnknownVariableError
+	instanceVariableNames: 'variableName'
+	package: 'Compiler-Semantic'!
+!UnknownVariableError commentStamp!
+I get signaled when a variable is not defined.
+The default behavior is to allow it, as this is how Amber currently is able to seamlessly send messages to JavaScript objects.!
+
+!UnknownVariableError methodsFor: 'accessing'!
+
+messageText
+	^ 'Unknown Variable error: ', self variableName, ' is not defined'
+!
+
+variableName
+	^ variableName
+!
+
+variableName: aString
+	variableName := aString
+! !
+

+ 61 - 1
src/Kernel-Infrastructure.js

@@ -1,4 +1,4 @@
-define("amber_core/Kernel-Infrastructure", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections"], function($boot){"use strict";
+define("amber_core/Kernel-Infrastructure", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Collections"], function($boot){"use strict";
 var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
 $core.addPackage('Kernel-Infrastructure');
 $core.packages["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
@@ -2279,6 +2279,66 @@ messageSends: ["observeSystem", "current"]
 $globals.PackageStateObserver.klass);
 
 
+$core.addClass('ParseError', $globals.Error, [], 'Kernel-Infrastructure');
+//>>excludeStart("ide", pragmas.excludeIdeData);
+$globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
+//>>excludeEnd("ide");
+
+
+$core.addClass('RethrowErrorHandler', $globals.Object, [], 'Kernel-Infrastructure');
+//>>excludeStart("ide", pragmas.excludeIdeData);
+$globals.RethrowErrorHandler.comment="This class is used in the commandline version of the compiler.\x0aIt uses the handleError: message of ErrorHandler for printing the stacktrace and throws the error again as JS exception.\x0aAs a result Smalltalk errors are not swallowd by the Amber runtime and compilation can be aborted.";
+//>>excludeEnd("ide");
+$core.addMethod(
+$core.method({
+selector: "basicSignal:",
+protocol: 'error handling',
+fn: function (anError){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+throw anError;
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},$globals.RethrowErrorHandler)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["anError"],
+source: "basicSignal: anError\x0a        <throw anError>",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: []
+}),
+$globals.RethrowErrorHandler);
+
+$core.addMethod(
+$core.method({
+selector: "handleError:",
+protocol: 'error handling',
+fn: function (anError){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+self._basicSignal_(anError);
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.RethrowErrorHandler)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["anError"],
+source: "handleError: anError\x0a        self basicSignal: anError",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["basicSignal:"]
+}),
+$globals.RethrowErrorHandler);
+
+
+
 $core.addClass('Setting', $globals.Object, ['key', 'value', 'defaultValue'], 'Kernel-Infrastructure');
 //>>excludeStart("ide", pragmas.excludeIdeData);
 $globals.Setting.comment="I represent a setting **stored** at `Smalltalk settings`. \x0aIn the current implementation, `Smalltalk settings` is an object persisted in the localStorage.\x0a\x0a## API\x0a\x0aA `Setting` value can be read using `value` and set using `value:`.\x0a\x0aSettings are accessed with `'key' asSetting` or `'key' asSettingIfAbsent: aDefaultValue`.\x0a\x0aTo read the value of a setting you can also use the convenience:\x0a\x0a`theValueSet :=  'any.characteristic' settingValue` \x0a\x0aor with a default using:\x0a\x0a `theEnsuredValueSet := 'any.characteristic' settingValueIfAbsent: true`";

+ 25 - 0
src/Kernel-Infrastructure.st

@@ -596,6 +596,31 @@ initialize
 	self current observeSystem
 ! !
 
+Error subclass: #ParseError
+	instanceVariableNames: ''
+	package: 'Kernel-Infrastructure'!
+!ParseError commentStamp!
+Instance of ParseError are signaled on any parsing error.
+See `Smalltalk >> #parse:`!
+
+Object subclass: #RethrowErrorHandler
+	instanceVariableNames: ''
+	package: 'Kernel-Infrastructure'!
+!RethrowErrorHandler commentStamp!
+This class is used in the commandline version of the compiler.
+It uses the handleError: message of ErrorHandler for printing the stacktrace and throws the error again as JS exception.
+As a result Smalltalk errors are not swallowd by the Amber runtime and compilation can be aborted.!
+
+!RethrowErrorHandler methodsFor: 'error handling'!
+
+basicSignal: anError
+        <throw anError>
+!
+
+handleError: anError
+        self basicSignal: anError
+! !
+
 Object subclass: #Setting
 	instanceVariableNames: 'key value defaultValue'
 	package: 'Kernel-Infrastructure'!

+ 0 - 1
support/lang.js

@@ -4,7 +4,6 @@ define([
 	'./parser',
 	// --- packages for the Amber reflection begin here ---
 	'amber_core/Platform-ImportExport',
-	'amber_core/Compiler-Exceptions',
 	'amber_core/Compiler-Core',
 	'amber_core/Compiler-AST',
 	'amber_core/Compiler-Semantic',