resin 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/amber/css/amber-normalize.css +73 -73
- data/amber/css/amber-normalize.less +1 -1
- data/amber/css/amber.css +106 -106
- data/amber/css/helios.css +242 -0
- data/amber/images/hsplitter.png +0 -0
- data/amber/images/vsplitter.png +0 -0
- data/amber/js/Benchfib.deploy.js +116 -38
- data/amber/js/Benchfib.js +120 -42
- data/amber/js/Canvas.deploy.js +674 -403
- data/amber/js/Canvas.js +682 -411
- data/amber/js/Compiler-AST.deploy.js +1150 -0
- data/amber/js/Compiler-AST.js +1591 -0
- data/amber/js/Compiler-Core.deploy.js +1562 -0
- data/amber/js/Compiler-Core.js +1972 -0
- data/amber/js/Compiler-Exceptions.deploy.js +114 -0
- data/amber/js/Compiler-Exceptions.js +161 -0
- data/amber/js/Compiler-IR.deploy.js +2326 -0
- data/amber/js/Compiler-IR.js +3146 -0
- data/amber/js/Compiler-Inlining.deploy.js +1147 -0
- data/amber/js/Compiler-Inlining.js +1514 -0
- data/amber/js/Compiler-Semantic.deploy.js +1207 -0
- data/amber/js/Compiler-Semantic.js +1628 -0
- data/amber/js/Compiler-Tests.deploy.js +646 -60
- data/amber/js/Compiler-Tests.js +843 -82
- data/amber/js/Compiler.deploy.js +1097 -159
- data/amber/js/Compiler.js +1414 -161
- data/amber/js/Examples.deploy.js +31 -15
- data/amber/js/Examples.js +33 -17
- data/amber/js/Helios-Announcements.deploy.js +127 -0
- data/amber/js/Helios-Announcements.js +157 -0
- data/amber/js/Helios-Browser.deploy.js +1473 -0
- data/amber/js/Helios-Browser.js +1953 -0
- data/amber/js/Helios-Commands.deploy.js +403 -0
- data/amber/js/Helios-Commands.js +563 -0
- data/amber/js/Helios-Core.deploy.js +1070 -0
- data/amber/js/Helios-Core.js +1445 -0
- data/amber/js/Helios-Environments.deploy.js +132 -0
- data/amber/js/Helios-Environments.js +179 -0
- data/amber/js/Helios-Inspector.deploy.js +855 -0
- data/amber/js/Helios-Inspector.js +1155 -0
- data/amber/js/Helios-KeyBindings.deploy.js +753 -0
- data/amber/js/Helios-KeyBindings.js +1023 -0
- data/amber/js/Helios-Layout.deploy.js +383 -0
- data/amber/js/Helios-Layout.js +523 -0
- data/amber/js/Helios-Workspace.deploy.js +799 -0
- data/amber/js/Helios-Workspace.js +1074 -0
- data/amber/js/IDE.deploy.js +2541 -1490
- data/amber/js/IDE.js +2721 -1660
- data/amber/js/Importer-Exporter.deploy.js +671 -0
- data/amber/js/Importer-Exporter.js +816 -0
- data/amber/js/Kernel-Announcements.deploy.js +137 -20
- data/amber/js/Kernel-Announcements.js +176 -22
- data/amber/js/Kernel-Classes.deploy.js +555 -168
- data/amber/js/Kernel-Classes.js +662 -205
- data/amber/js/Kernel-Collections.deploy.js +1403 -618
- data/amber/js/Kernel-Collections.js +1545 -690
- data/amber/js/Kernel-Exceptions.deploy.js +109 -45
- data/amber/js/Kernel-Exceptions.js +123 -49
- data/amber/js/Kernel-Methods.deploy.js +196 -81
- data/amber/js/Kernel-Methods.js +214 -89
- data/amber/js/Kernel-Objects.deploy.js +1542 -1117
- data/amber/js/Kernel-Objects.js +1593 -1148
- data/amber/js/Kernel-Tests.deploy.js +1725 -772
- data/amber/js/Kernel-Tests.js +2301 -1123
- data/amber/js/Kernel-Transcript.deploy.js +23 -25
- data/amber/js/Kernel-Transcript.js +24 -26
- data/amber/js/SUnit.deploy.js +204 -131
- data/amber/js/SUnit.js +222 -139
- data/amber/js/Spaces.deploy.js +240 -0
- data/amber/js/Spaces.js +326 -0
- data/amber/js/amber.js +26 -7
- data/amber/js/boot.js +65 -47
- data/amber/js/init.js +1 -1
- data/amber/js/lib/CodeMirror/amber.css +21 -21
- data/amber/js/lib/CodeMirror/codemirror.css +119 -13
- data/amber/js/lib/CodeMirror/codemirror.js +2219 -1220
- data/amber/js/lib/CodeMirror/smalltalk.js +134 -129
- data/amber/js/lib/bootstrap/css/bootstrap.css +5837 -0
- data/amber/js/lib/bootstrap/css/bootstrap.min.css +841 -0
- data/amber/js/lib/bootstrap/img/glyphicons-halflings-white.png +0 -0
- data/amber/js/lib/bootstrap/img/glyphicons-halflings.png +0 -0
- data/amber/js/lib/bootstrap/js/bootstrap.js +2038 -0
- data/amber/js/lib/bootstrap/js/bootstrap.min.js +7 -0
- data/amber/js/lib/jQuery/jquery-1.8.2.min.js +2 -0
- data/amber/js/lib/jQuery/jquery-ui-1.8.24.custom.min.js +125 -0
- data/amber/st/Compiler-AST.st +505 -0
- data/amber/st/Compiler-Core.st +835 -0
- data/amber/st/Compiler-Exceptions.st +87 -0
- data/amber/st/Compiler-IR.st +1097 -0
- data/amber/st/Compiler-Inlining.st +650 -0
- data/amber/st/Compiler-Semantic.st +558 -0
- data/amber/st/Compiler-Tests.st +285 -381
- data/amber/st/Compiler.st +725 -2
- data/amber/st/Helios-Announcements.st +104 -0
- data/amber/st/Helios-Browser.st +708 -0
- data/amber/st/Helios-Commands.st +223 -0
- data/amber/st/Helios-Core.st +532 -0
- data/amber/st/Helios-Environments.st +98 -0
- data/amber/st/Helios-Inspector.st +367 -0
- data/amber/st/Helios-KeyBindings.st +337 -0
- data/amber/st/Helios-Layout.st +199 -0
- data/amber/st/Helios-Workspace.st +367 -0
- data/amber/st/IDE.st +75 -53
- data/amber/st/Importer-Exporter.st +386 -0
- data/amber/st/Kernel-Announcements.st +92 -0
- data/amber/st/Kernel-Classes.st +137 -15
- data/amber/st/Kernel-Collections.st +137 -47
- data/amber/st/Kernel-Exceptions.st +14 -0
- data/amber/st/Kernel-Methods.st +9 -1
- data/amber/st/Kernel-Objects.st +29 -5
- data/amber/st/Kernel-Tests.st +545 -199
- data/amber/st/SUnit.st +10 -0
- data/amber/st/Spaces.st +142 -0
- data/lib/resin/app.rb +1 -1
- metadata +86 -31
- data/amber/js/lib/jQuery/jquery-1.4.4.min.js +0 -167
- data/amber/js/lib/jQuery/jquery-1.6.4.min.js +0 -4
data/amber/js/Compiler-Tests.js
CHANGED
@@ -1,137 +1,898 @@
|
|
1
1
|
smalltalk.addPackage('Compiler-Tests', {});
|
2
|
-
smalltalk.addClass('
|
2
|
+
smalltalk.addClass('CodeGeneratorTest', smalltalk.TestCase, ['receiver'], 'Compiler-Tests');
|
3
3
|
smalltalk.addMethod(
|
4
|
-
"
|
4
|
+
"_codeGeneratorClass",
|
5
5
|
smalltalk.method({
|
6
|
-
selector: "
|
7
|
-
category: '
|
8
|
-
fn: function (){
|
9
|
-
var self=this;
|
10
|
-
return "Smalltalk current createPackage: 'Cypress-Definitions' properties: #{}!\x0aObject subclass: #CypressSnapshot\x0a\x09instanceVariableNames: 'definitions'\x0a\x09package: 'Cypress-Definitions'!\x0a\x0a!CypressSnapshot methodsFor: 'not yet classified'!\x0a\x0adefinitions: aDefinitions\x0a\x0a\x09definitions := aDefinitions\x0a!\x0a\x0adefinitions\x0a\x0a\x09^definitions\x0a! !\x0a\x0a!CypressSnapshot class methodsFor: 'not yet classified'!\x0a\x0adefinitions: aDefinitions\x0a\x0a\x09^(self new) definitions: aDefinitions\x0a! !\x0a\x0aObject subclass: #CypressPackage\x0a\x09instanceVariableNames: 'name'\x0a\x09package: 'Cypress-Definitions'!\x0a\x0a!CypressPackage methodsFor: 'not yet classified'!\x0a\x0a= other\x0a\x09^ other species = self species and: [other name sameAs: name]\x0a!\x0a\x0aname\x0a\x09^ name\x0a!\x0a\x0aname: aString\x0a\x09name := aString\x0a!\x0a\x0asnapshot\x0a\x09| package definitions name |\x0a\x09package := Package named: self name.\x0a\x09definitions := OrderedCollection new.\x0a\x09package sortedClasses do: [:cls |\x0a \x09definitions add: cls asCypressClassDefinition.\x0a cls methodDictionary values do: [:method |\x0a\x09\x09\x09(method category match: '^\x5c*') ifFalse: [ \x0a\x09\x09\x09\x09definitions add: method asCypressMethodDefinition ]].\x0a cls class methodDictionary values do: [:method |\x0a\x09\x09\x09(method category match: '^\x5c*') ifFalse: [ \x0a\x09\x09\x09\x09definitions add: method asCypressMethodDefinition ]]].\x0a\x09name := package name.\x0a\x09Smalltalk current classes, (Smalltalk current classes collect: [:each | each class]) do: [:each |\x0a\x09\x09each methodDictionary values do: [:method |\x0a\x09\x09\x09method category = ('*', name) ifTrue: [\x0a\x09\x09\x09\x09definitions add: method asCypressMethodDefinition ]]].\x0a\x09^ CypressSnapshot definitions: definitions\x0a!\x0a\x0aprintString\x0a\x09^super printString, '(', name, ')'\x0a! !\x0a\x0aObject subclass: #CypressDefinition\x0a\x09instanceVariableNames: ''\x0a\x09package: 'Cypress-Definitions'!\x0a\x0a!CypressDefinition methodsFor: 'not yet classified'!\x0a\x0a= aDefinition\x0a\x09^(aDefinition isKindOf: CypressDefinition) and: [self isRevisionOf: aDefinition]\x0a!\x0a\x0aisRevisionOf: aDefinition\x0a\x09^ (aDefinition isKindOf: CypressDefinition) and: [aDefinition description = self description]\x0a!\x0a\x0adescription\x0a\x09self subclassResponsibility\x0a!\x0a\x0aisSameRevisionAs: aDefinition\x0a\x09^ self = aDefinition\x0a! !\x0a\x0aObject subclass: #CypressPatch\x0a\x09instanceVariableNames: 'operations'\x0a\x09package: 'Cypress-Definitions'!\x0a\x0a!CypressPatch methodsFor: 'not yet classified'!\x0a\x0afromBase: baseSnapshot toTarget: targetSnapshot\x0a\x09| base target |\x09\x0a\x09operations := OrderedCollection new.\x0a\x09base := CypressDefinitionIndex definitions: baseSnapshot definitions.\x0a\x09target := CypressDefinitionIndex definitions: targetSnapshot definitions.\x0a\x09\x0a\x09target definitions do:\x0a\x09\x09[:t |\x0a\x09\x09base\x0a\x09\x09\x09definitionLike: t\x0a\x09\x09\x09ifPresent: [:b | (b isSameRevisionAs: t) ifFalse: [operations add: (CypressModification of: b to: t)]]\x0a\x09\x09\x09ifAbsent: [operations add: (CypressAddition of: t)]].\x0a\x09\x09\x0a\x09base definitions do:\x0a\x09\x09[:b |\x0a\x09\x09target\x0a\x09\x09\x09definitionLike: b\x0a\x09\x09\x09ifPresent: [:t | ]\x0a\x09\x09\x09ifAbsent: [operations add: (CypressRemoval of: b)]]\x0a!\x0a\x0aoperations\x0a\x0a\x09^operations\x0a! !\x0a\x0a!CypressPatch class methodsFor: 'not yet classified'!\x0a\x0afromBase: baseSnapshot toTarget: targetSnapshot\x0a\x09^ (self new)\x0a\x09\x09fromBase: baseSnapshot\x0a\x09\x09toTarget: targetSnapshot\x0a! !\x0a\x0aObject subclass: #CypressDefinitionIndex\x0a\x09instanceVariableNames: 'definitionMap'\x0a\x09package: 'Cypress-Definitions'!\x0a\x0a!CypressDefinitionIndex methodsFor: 'not yet classified'!\x0a\x0aadd: aDefinition\x0a\x09^ self definitionMap at: aDefinition description put: aDefinition\x0a!\x0a\x0aaddAll: aCollection\x0a\x09aCollection do: [:ea | self add: ea]\x0a!\x0a\x0adefinitionLike: aDefinition ifPresent: foundBlock ifAbsent: errorBlock\x0a\x09| definition |\x0a\x09definition := self definitionMap at: aDefinition description ifAbsent: [].\x0a\x09^ definition\x0a\x09\x09ifNil: errorBlock\x0a\x09\x09ifNotNil: [foundBlock value: definition]\x0a!\x0a\x0adefinitions\x0a\x09^self definitionMap values\x0a!\x0a\x0adefinitionMap\x0a\x09definitionMap ifNil: [ definitionMap := Dictionary new ].\x0a\x09^ definitionMap\x0a!\x0a\x0aremove: aDefinition\x0a\x09self definitionMap removeKey: aDefinition description ifAbsent: []\x0a! !\x0a\x0a!CypressDefinitionIndex class methodsFor: 'not yet classified'!\x0a\x0adefinitions: aCollection\x0a\x09^ self new addAll: aCollection\x0a! !\x0a\x0aObject subclass: #CypressPatchOperation\x0a\x09instanceVariableNames: ''\x0a\x09package: 'Cypress-Definitions'!\x0a\x0aCypressDefinition subclass: #CypressClassDefinition\x0a\x09instanceVariableNames: 'name superclassName category comment instVarNames classInstVarNames'\x0a\x09package: 'Cypress-Definitions'!\x0a\x0a!CypressClassDefinition methodsFor: 'not yet classified'!\x0a\x0aname: aClassName superclassName: aSuperclassName category: aCategory instVarNames: anInstanceVariableNames classInstVarNames: aClassInstanceVariableNames comment: aComment\x0a\x0a\x09name := aClassName.\x0a\x09superclassName := aSuperclassName.\x0a\x09category := aCategory.\x0a\x09instVarNames := anInstanceVariableNames.\x0a\x09classInstVarNames := aClassInstanceVariableNames.\x0a\x09comment := aComment\x0a!\x0a\x0a= aDefinition\x0a\x09^(super = aDefinition)\x0a\x09\x09and: [superclassName = aDefinition superclassName\x0a\x09\x09and: [category = aDefinition category\x0a\x09\x09and: [instVarNames = aDefinition instVarNames\x0a\x09\x09and: [classInstVarNames = aDefinition classInstVarNames\x0a\x09\x09and: [comment = aDefinition comment]]]]]\x0a!\x0a\x0asuperclassName\x0a\x0a\x09^superclassName\x0a!\x0a\x0aname\x0a\x0a\x09^name\x0a!\x0a\x0acategory\x0a\x0a\x09^category\x0a!\x0a\x0acomment\x0a\x0a\x09^comment\x0a!\x0a\x0adescription\x0a\x0a\x09^ Array with: name\x0a!\x0a\x0ainstVarNames\x0a\x0a\x09^instVarNames\x0a!\x0a\x0aclassInstVarNames\x0a\x0a\x09^classInstVarNames\x0a! !\x0a\x0a!CypressClassDefinition class methodsFor: 'not yet classified'!\x0a\x0aname: aClassName \x0asuperclassName: aSuperclassName\x0acategory: aCategory\x0ainstVarNames: anInstanceVariableNames\x0aclassInstVarNames: aClassInstanceVariableNames\x0acomment: aComment\x0a\x0a\x09^(self new) \x0a\x09\x09name: aClassName \x0a\x09\x09superclassName: aSuperclassName\x0a\x09\x09category: aCategory\x0a\x09\x09instVarNames: anInstanceVariableNames\x0a\x09\x09classInstVarNames: aClassInstanceVariableNames\x0a\x09\x09comment: aComment\x0a! !\x0a\x0aCypressDefinition subclass: #CypressMethodDefinition\x0a\x09instanceVariableNames: 'classIsMeta source category selector className'\x0a\x09package: 'Cypress-Definitions'!\x0a\x0a!CypressMethodDefinition methodsFor: 'not yet classified'!\x0a\x0aclassName: aName classIsMeta: isMetaclass selector: aSelector category: aCategory source: aSource\x0a\x0a\x09className := aName.\x0a\x09classIsMeta := isMetaclass.\x0a\x09selector := aSelector.\x0a\x09category := aCategory.\x0a\x09source := aSource.\x0a!\x0a\x0a= aDefinition\x0a ^ super = aDefinition\x0a and: [ aDefinition source = self source\x0a and: [ aDefinition category = self category ] ]\x0a!\x0a\x0asource\x0a\x0a\x09^source\x0a!\x0a\x0acategory\x0a\x0a\x09^category\x0a!\x0a\x0adescription\x0a\x09^ Array\x09\x0a\x09\x09with: className\x0a\x09\x09with: selector\x0a\x09\x09with: classIsMeta\x0a! !\x0a\x0a!CypressMethodDefinition class methodsFor: 'not yet classified'!\x0a\x0aclassName: aName\x0aclassIsMeta: isMetaclass\x0aselector: aSelector\x0acategory: aCategory\x0asource: aSource\x0a\x0a\x09^(self new)\x0a\x09\x09className: aName\x0a\x09\x09classIsMeta: isMetaclass\x0a\x09\x09selector: aSelector\x0a\x09\x09category: aCategory\x0a\x09\x09source: aSource\x0a! !\x0a\x0aCypressPatchOperation subclass: #CypressAddition\x0a\x09instanceVariableNames: 'definition'\x0a\x09package: 'Cypress-Definitions'!\x0a\x0a!CypressAddition methodsFor: 'not yet classified'!\x0a\x0adefinition: aDefinition\x0a\x0a\x09definition := aDefinition\x0a! !\x0a\x0a!CypressAddition class methodsFor: 'not yet classified'!\x0a\x0aof: aDefinition\x0a\x09^ self new definition: aDefinition\x0a! !\x0a\x0aCypressPatchOperation subclass: #CypressModification\x0a\x09instanceVariableNames: 'obsoletion modification'\x0a\x09package: 'Cypress-Definitions'!\x0a\x0a!CypressModification methodsFor: 'not yet classified'!\x0a\x0abase: base target: target\x0a\x0a\x09obsoletion := base.\x0a\x09modification := target.\x0a! !\x0a\x0a!CypressModification class methodsFor: 'not yet classified'!\x0a\x0aof: base to: target\x0a\x09^ self new base: base target: target\x0a! !\x0a\x0aCypressPatchOperation subclass: #CypressRemoval\x0a\x09instanceVariableNames: 'definition'\x0a\x09package: 'Cypress-Definitions'!\x0a\x0a!CypressRemoval methodsFor: 'not yet classified'!\x0a\x0adefinition: aDefinition\x0a\x0a\x09definition := aDefinition\x0a! !\x0a\x0a!CypressRemoval class methodsFor: 'not yet classified'!\x0a\x0aof: aDefinition\x0a\x09^ self new definition: aDefinition\x0a! !\x0a\x0a!Object methodsFor: '*Cypress-Definitions'!\x0a\x0aspecies\x0a\x0a\x09^self class\x0a! !\x0a\x0a!Class methodsFor: '*Cypress-Definitions'!\x0a\x0aasCypressClassDefinition\x0a\x09^CypressClassDefinition\x0a\x09\x09name: self name\x0a\x09\x09superclassName: self superclass name\x0a\x09\x09category: self category \x0a\x09\x09instVarNames: self instanceVariableNames\x0a\x09\x09classInstVarNames: self class instanceVariableNames\x0a\x09\x09comment: self comment\x0a! !\x0a\x0a!CompiledMethod methodsFor: '*Cypress-Definitions'!\x0a\x0aasCypressMethodDefinition\x0a\x0a\x09^CypressMethodDefinition \x0a \x09className: self methodClass name\x0a\x09\x09classIsMeta: self methodClass isMetaclass\x0a\x09\x09selector: self selector\x0a\x09\x09category: self category\x0a\x09\x09source: self source\x0a! !\x0a\x0a!CharacterArray methodsFor: '*Cypress-Definitions'!\x0a\x0asameAs: aString\x0a\x0a\x09^self asUppercase = aString asUppercase\x0a! !\x0a\x0a";
|
11
|
-
|
6
|
+
selector: "codeGeneratorClass",
|
7
|
+
category: 'accessing',
|
8
|
+
fn: function () {
|
9
|
+
var self = this;
|
10
|
+
return smalltalk.CodeGenerator || CodeGenerator;
|
11
|
+
},
|
12
12
|
args: [],
|
13
|
-
source: "bigChunkString\x0a\x0a\x09^'Smalltalk current createPackage: ''Cypress-Definitions'' properties: #{}!\x0aObject subclass: #CypressSnapshot\x0a\x09instanceVariableNames: ''definitions''\x0a\x09package: ''Cypress-Definitions''!\x0a\x0a!CypressSnapshot methodsFor: ''not yet classified''!\x0a\x0adefinitions: aDefinitions\x0a\x0a\x09definitions := aDefinitions\x0a!\x0a\x0adefinitions\x0a\x0a\x09^definitions\x0a! !\x0a\x0a!CypressSnapshot class methodsFor: ''not yet classified''!\x0a\x0adefinitions: aDefinitions\x0a\x0a\x09^(self new) definitions: aDefinitions\x0a! !\x0a\x0aObject subclass: #CypressPackage\x0a\x09instanceVariableNames: ''name''\x0a\x09package: ''Cypress-Definitions''!\x0a\x0a!CypressPackage methodsFor: ''not yet classified''!\x0a\x0a= other\x0a\x09^ other species = self species and: [other name sameAs: name]\x0a!\x0a\x0aname\x0a\x09^ name\x0a!\x0a\x0aname: aString\x0a\x09name := aString\x0a!\x0a\x0asnapshot\x0a\x09| package definitions name |\x0a\x09package := Package named: self name.\x0a\x09definitions := OrderedCollection new.\x0a\x09package sortedClasses do: [:cls |\x0a \x09definitions add: cls asCypressClassDefinition.\x0a cls methodDictionary values do: [:method |\x0a\x09\x09\x09(method category match: ''^\x5c*'') ifFalse: [ \x0a\x09\x09\x09\x09definitions add: method asCypressMethodDefinition ]].\x0a cls class methodDictionary values do: [:method |\x0a\x09\x09\x09(method category match: ''^\x5c*'') ifFalse: [ \x0a\x09\x09\x09\x09definitions add: method asCypressMethodDefinition ]]].\x0a\x09name := package name.\x0a\x09Smalltalk current classes, (Smalltalk current classes collect: [:each | each class]) do: [:each |\x0a\x09\x09each methodDictionary values do: [:method |\x0a\x09\x09\x09method category = (''*'', name) ifTrue: [\x0a\x09\x09\x09\x09definitions add: method asCypressMethodDefinition ]]].\x0a\x09^ CypressSnapshot definitions: definitions\x0a!\x0a\x0aprintString\x0a\x09^super printString, ''('', name, '')''\x0a! !\x0a\x0aObject subclass: #CypressDefinition\x0a\x09instanceVariableNames: ''''\x0a\x09package: ''Cypress-Definitions''!\x0a\x0a!CypressDefinition methodsFor: ''not yet classified''!\x0a\x0a= aDefinition\x0a\x09^(aDefinition isKindOf: CypressDefinition) and: [self isRevisionOf: aDefinition]\x0a!\x0a\x0aisRevisionOf: aDefinition\x0a\x09^ (aDefinition isKindOf: CypressDefinition) and: [aDefinition description = self description]\x0a!\x0a\x0adescription\x0a\x09self subclassResponsibility\x0a!\x0a\x0aisSameRevisionAs: aDefinition\x0a\x09^ self = aDefinition\x0a! !\x0a\x0aObject subclass: #CypressPatch\x0a\x09instanceVariableNames: ''operations''\x0a\x09package: ''Cypress-Definitions''!\x0a\x0a!CypressPatch methodsFor: ''not yet classified''!\x0a\x0afromBase: baseSnapshot toTarget: targetSnapshot\x0a\x09| base target |\x09\x0a\x09operations := OrderedCollection new.\x0a\x09base := CypressDefinitionIndex definitions: baseSnapshot definitions.\x0a\x09target := CypressDefinitionIndex definitions: targetSnapshot definitions.\x0a\x09\x0a\x09target definitions do:\x0a\x09\x09[:t |\x0a\x09\x09base\x0a\x09\x09\x09definitionLike: t\x0a\x09\x09\x09ifPresent: [:b | (b isSameRevisionAs: t) ifFalse: [operations add: (CypressModification of: b to: t)]]\x0a\x09\x09\x09ifAbsent: [operations add: (CypressAddition of: t)]].\x0a\x09\x09\x0a\x09base definitions do:\x0a\x09\x09[:b |\x0a\x09\x09target\x0a\x09\x09\x09definitionLike: b\x0a\x09\x09\x09ifPresent: [:t | ]\x0a\x09\x09\x09ifAbsent: [operations add: (CypressRemoval of: b)]]\x0a!\x0a\x0aoperations\x0a\x0a\x09^operations\x0a! !\x0a\x0a!CypressPatch class methodsFor: ''not yet classified''!\x0a\x0afromBase: baseSnapshot toTarget: targetSnapshot\x0a\x09^ (self new)\x0a\x09\x09fromBase: baseSnapshot\x0a\x09\x09toTarget: targetSnapshot\x0a! !\x0a\x0aObject subclass: #CypressDefinitionIndex\x0a\x09instanceVariableNames: ''definitionMap''\x0a\x09package: ''Cypress-Definitions''!\x0a\x0a!CypressDefinitionIndex methodsFor: ''not yet classified''!\x0a\x0aadd: aDefinition\x0a\x09^ self definitionMap at: aDefinition description put: aDefinition\x0a!\x0a\x0aaddAll: aCollection\x0a\x09aCollection do: [:ea | self add: ea]\x0a!\x0a\x0adefinitionLike: aDefinition ifPresent: foundBlock ifAbsent: errorBlock\x0a\x09| definition |\x0a\x09definition := self definitionMap at: aDefinition description ifAbsent: [].\x0a\x09^ definition\x0a\x09\x09ifNil: errorBlock\x0a\x09\x09ifNotNil: [foundBlock value: definition]\x0a!\x0a\x0adefinitions\x0a\x09^self definitionMap values\x0a!\x0a\x0adefinitionMap\x0a\x09definitionMap ifNil: [ definitionMap := Dictionary new ].\x0a\x09^ definitionMap\x0a!\x0a\x0aremove: aDefinition\x0a\x09self definitionMap removeKey: aDefinition description ifAbsent: []\x0a! !\x0a\x0a!CypressDefinitionIndex class methodsFor: ''not yet classified''!\x0a\x0adefinitions: aCollection\x0a\x09^ self new addAll: aCollection\x0a! !\x0a\x0aObject subclass: #CypressPatchOperation\x0a\x09instanceVariableNames: ''''\x0a\x09package: ''Cypress-Definitions''!\x0a\x0aCypressDefinition subclass: #CypressClassDefinition\x0a\x09instanceVariableNames: ''name superclassName category comment instVarNames classInstVarNames''\x0a\x09package: ''Cypress-Definitions''!\x0a\x0a!CypressClassDefinition methodsFor: ''not yet classified''!\x0a\x0aname: aClassName superclassName: aSuperclassName category: aCategory instVarNames: anInstanceVariableNames classInstVarNames: aClassInstanceVariableNames comment: aComment\x0a\x0a\x09name := aClassName.\x0a\x09superclassName := aSuperclassName.\x0a\x09category := aCategory.\x0a\x09instVarNames := anInstanceVariableNames.\x0a\x09classInstVarNames := aClassInstanceVariableNames.\x0a\x09comment := aComment\x0a!\x0a\x0a= aDefinition\x0a\x09^(super = aDefinition)\x0a\x09\x09and: [superclassName = aDefinition superclassName\x0a\x09\x09and: [category = aDefinition category\x0a\x09\x09and: [instVarNames = aDefinition instVarNames\x0a\x09\x09and: [classInstVarNames = aDefinition classInstVarNames\x0a\x09\x09and: [comment = aDefinition comment]]]]]\x0a!\x0a\x0asuperclassName\x0a\x0a\x09^superclassName\x0a!\x0a\x0aname\x0a\x0a\x09^name\x0a!\x0a\x0acategory\x0a\x0a\x09^category\x0a!\x0a\x0acomment\x0a\x0a\x09^comment\x0a!\x0a\x0adescription\x0a\x0a\x09^ Array with: name\x0a!\x0a\x0ainstVarNames\x0a\x0a\x09^instVarNames\x0a!\x0a\x0aclassInstVarNames\x0a\x0a\x09^classInstVarNames\x0a! !\x0a\x0a!CypressClassDefinition class methodsFor: ''not yet classified''!\x0a\x0aname: aClassName \x0asuperclassName: aSuperclassName\x0acategory: aCategory\x0ainstVarNames: anInstanceVariableNames\x0aclassInstVarNames: aClassInstanceVariableNames\x0acomment: aComment\x0a\x0a\x09^(self new) \x0a\x09\x09name: aClassName \x0a\x09\x09superclassName: aSuperclassName\x0a\x09\x09category: aCategory\x0a\x09\x09instVarNames: anInstanceVariableNames\x0a\x09\x09classInstVarNames: aClassInstanceVariableNames\x0a\x09\x09comment: aComment\x0a! !\x0a\x0aCypressDefinition subclass: #CypressMethodDefinition\x0a\x09instanceVariableNames: ''classIsMeta source category selector className''\x0a\x09package: ''Cypress-Definitions''!\x0a\x0a!CypressMethodDefinition methodsFor: ''not yet classified''!\x0a\x0aclassName: aName classIsMeta: isMetaclass selector: aSelector category: aCategory source: aSource\x0a\x0a\x09className := aName.\x0a\x09classIsMeta := isMetaclass.\x0a\x09selector := aSelector.\x0a\x09category := aCategory.\x0a\x09source := aSource.\x0a!\x0a\x0a= aDefinition\x0a ^ super = aDefinition\x0a and: [ aDefinition source = self source\x0a and: [ aDefinition category = self category ] ]\x0a!\x0a\x0asource\x0a\x0a\x09^source\x0a!\x0a\x0acategory\x0a\x0a\x09^category\x0a!\x0a\x0adescription\x0a\x09^ Array\x09\x0a\x09\x09with: className\x0a\x09\x09with: selector\x0a\x09\x09with: classIsMeta\x0a! !\x0a\x0a!CypressMethodDefinition class methodsFor: ''not yet classified''!\x0a\x0aclassName: aName\x0aclassIsMeta: isMetaclass\x0aselector: aSelector\x0acategory: aCategory\x0asource: aSource\x0a\x0a\x09^(self new)\x0a\x09\x09className: aName\x0a\x09\x09classIsMeta: isMetaclass\x0a\x09\x09selector: aSelector\x0a\x09\x09category: aCategory\x0a\x09\x09source: aSource\x0a! !\x0a\x0aCypressPatchOperation subclass: #CypressAddition\x0a\x09instanceVariableNames: ''definition''\x0a\x09package: ''Cypress-Definitions''!\x0a\x0a!CypressAddition methodsFor: ''not yet classified''!\x0a\x0adefinition: aDefinition\x0a\x0a\x09definition := aDefinition\x0a! !\x0a\x0a!CypressAddition class methodsFor: ''not yet classified''!\x0a\x0aof: aDefinition\x0a\x09^ self new definition: aDefinition\x0a! !\x0a\x0aCypressPatchOperation subclass: #CypressModification\x0a\x09instanceVariableNames: ''obsoletion modification''\x0a\x09package: ''Cypress-Definitions''!\x0a\x0a!CypressModification methodsFor: ''not yet classified''!\x0a\x0abase: base target: target\x0a\x0a\x09obsoletion := base.\x0a\x09modification := target.\x0a! !\x0a\x0a!CypressModification class methodsFor: ''not yet classified''!\x0a\x0aof: base to: target\x0a\x09^ self new base: base target: target\x0a! !\x0a\x0aCypressPatchOperation subclass: #CypressRemoval\x0a\x09instanceVariableNames: ''definition''\x0a\x09package: ''Cypress-Definitions''!\x0a\x0a!CypressRemoval methodsFor: ''not yet classified''!\x0a\x0adefinition: aDefinition\x0a\x0a\x09definition := aDefinition\x0a! !\x0a\x0a!CypressRemoval class methodsFor: ''not yet classified''!\x0a\x0aof: aDefinition\x0a\x09^ self new definition: aDefinition\x0a! !\x0a\x0a!Object methodsFor: ''*Cypress-Definitions''!\x0a\x0aspecies\x0a\x0a\x09^self class\x0a! !\x0a\x0a!Class methodsFor: ''*Cypress-Definitions''!\x0a\x0aasCypressClassDefinition\x0a\x09^CypressClassDefinition\x0a\x09\x09name: self name\x0a\x09\x09superclassName: self superclass name\x0a\x09\x09category: self category \x0a\x09\x09instVarNames: self instanceVariableNames\x0a\x09\x09classInstVarNames: self class instanceVariableNames\x0a\x09\x09comment: self comment\x0a! !\x0a\x0a!CompiledMethod methodsFor: ''*Cypress-Definitions''!\x0a\x0aasCypressMethodDefinition\x0a\x0a\x09^CypressMethodDefinition \x0a \x09className: self methodClass name\x0a\x09\x09classIsMeta: self methodClass isMetaclass\x0a\x09\x09selector: self selector\x0a\x09\x09category: self category\x0a\x09\x09source: self source\x0a! !\x0a\x0a!CharacterArray methodsFor: ''*Cypress-Definitions''!\x0a\x0asameAs: aString\x0a\x0a\x09^self asUppercase = aString asUppercase\x0a! !\x0a\x0a'",
|
13
|
+
source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
|
14
14
|
messageSends: [],
|
15
|
+
referencedClasses: ["CodeGenerator"]
|
16
|
+
}),
|
17
|
+
smalltalk.CodeGeneratorTest);
|
18
|
+
|
19
|
+
smalltalk.addMethod(
|
20
|
+
"_compiler",
|
21
|
+
smalltalk.method({
|
22
|
+
selector: "compiler",
|
23
|
+
category: 'factory',
|
24
|
+
fn: function () {
|
25
|
+
var self = this;
|
26
|
+
var $2, $3, $1;
|
27
|
+
$2 = smalltalk.send(smalltalk.Compiler || Compiler, "_new", []);
|
28
|
+
smalltalk.send($2, "_codeGeneratorClass_", [smalltalk.send(self, "_codeGeneratorClass", [])]);
|
29
|
+
$3 = smalltalk.send($2, "_yourself", []);
|
30
|
+
$1 = $3;
|
31
|
+
return $1;
|
32
|
+
},
|
33
|
+
args: [],
|
34
|
+
source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
|
35
|
+
messageSends: ["codeGeneratorClass:", "codeGeneratorClass", "new", "yourself"],
|
36
|
+
referencedClasses: ["Compiler"]
|
37
|
+
}),
|
38
|
+
smalltalk.CodeGeneratorTest);
|
39
|
+
|
40
|
+
smalltalk.addMethod(
|
41
|
+
"_setUp",
|
42
|
+
smalltalk.method({
|
43
|
+
selector: "setUp",
|
44
|
+
category: 'initialization',
|
45
|
+
fn: function () {
|
46
|
+
var self = this;
|
47
|
+
self['@receiver'] = smalltalk.send(smalltalk.send(self, "_targetClass", []), "_new", []);
|
48
|
+
return self;
|
49
|
+
},
|
50
|
+
args: [],
|
51
|
+
source: "setUp\x0a\x09receiver := self targetClass new",
|
52
|
+
messageSends: ["new", "targetClass"],
|
15
53
|
referencedClasses: []
|
16
54
|
}),
|
17
|
-
smalltalk.
|
55
|
+
smalltalk.CodeGeneratorTest);
|
18
56
|
|
19
57
|
smalltalk.addMethod(
|
20
|
-
"
|
58
|
+
"_should_return_",
|
21
59
|
smalltalk.method({
|
22
|
-
selector: "
|
23
|
-
category: '
|
24
|
-
fn: function (){
|
25
|
-
var self=this;
|
26
|
-
|
27
|
-
|
60
|
+
selector: "should:return:",
|
61
|
+
category: 'testing',
|
62
|
+
fn: function (aString, anObject) {
|
63
|
+
var self = this;
|
64
|
+
var method;
|
65
|
+
var result;
|
66
|
+
method = smalltalk.send(smalltalk.send(self, "_compiler", []), "_install_forClass_category_", [aString, smalltalk.send(self, "_targetClass", []), "tests"]);
|
67
|
+
result = smalltalk.send(self['@receiver'], "_perform_", [smalltalk.send(method, "_selector", [])]);
|
68
|
+
smalltalk.send(smalltalk.send(self, "_targetClass", []), "_removeCompiledMethod_", [method]);
|
69
|
+
smalltalk.send(self, "_assert_equals_", [anObject, result]);
|
70
|
+
return self;
|
71
|
+
},
|
72
|
+
args: ["aString", "anObject"],
|
73
|
+
source: "should: aString return: anObject\x0a\x09| method result |\x0a\x0a\x09method := self compiler install: aString forClass: self targetClass category: 'tests'.\x0a\x09result := receiver perform: method selector.\x0a\x09self targetClass removeCompiledMethod: method.\x0a\x09self assert: anObject equals: result",
|
74
|
+
messageSends: ["install:forClass:category:", "targetClass", "compiler", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"],
|
75
|
+
referencedClasses: []
|
76
|
+
}),
|
77
|
+
smalltalk.CodeGeneratorTest);
|
78
|
+
|
79
|
+
smalltalk.addMethod(
|
80
|
+
"_targetClass",
|
81
|
+
smalltalk.method({
|
82
|
+
selector: "targetClass",
|
83
|
+
category: 'accessing',
|
84
|
+
fn: function () {
|
85
|
+
var self = this;
|
86
|
+
return smalltalk.DoIt || DoIt;
|
87
|
+
},
|
28
88
|
args: [],
|
29
|
-
source: "
|
89
|
+
source: "targetClass\x0a\x09^ DoIt",
|
90
|
+
messageSends: [],
|
91
|
+
referencedClasses: ["DoIt"]
|
92
|
+
}),
|
93
|
+
smalltalk.CodeGeneratorTest);
|
94
|
+
|
95
|
+
smalltalk.addMethod(
|
96
|
+
"_tearDown",
|
97
|
+
smalltalk.method({
|
98
|
+
selector: "tearDown",
|
99
|
+
category: 'initialization',
|
100
|
+
fn: function () {
|
101
|
+
var self = this;
|
102
|
+
return self;
|
103
|
+
},
|
104
|
+
args: [],
|
105
|
+
source: "tearDown\x0a\x09\x22receiver := nil\x22",
|
30
106
|
messageSends: [],
|
31
107
|
referencedClasses: []
|
32
108
|
}),
|
33
|
-
smalltalk.
|
109
|
+
smalltalk.CodeGeneratorTest);
|
34
110
|
|
35
111
|
smalltalk.addMethod(
|
36
|
-
"
|
112
|
+
"_testAssignment",
|
37
113
|
smalltalk.method({
|
38
|
-
selector: "
|
39
|
-
category: '
|
40
|
-
fn: function (){
|
41
|
-
var self=this;
|
42
|
-
|
43
|
-
|
114
|
+
selector: "testAssignment",
|
115
|
+
category: 'tests',
|
116
|
+
fn: function () {
|
117
|
+
var self = this;
|
118
|
+
smalltalk.send(self, "_should_return_", ["foo | a | a := true ifTrue: [ 1 ]. ^ a", 1]);
|
119
|
+
smalltalk.send(self, "_should_return_", ["foo | a | a := false ifTrue: [ 1 ]. ^ a", nil]);
|
120
|
+
smalltalk.send(self, "_should_return_", ["foo | a | ^ a := true ifTrue: [ 1 ]", 1]);
|
121
|
+
return self;
|
122
|
+
},
|
123
|
+
args: [],
|
124
|
+
source: "testAssignment\x0a\x09self should: 'foo | a | a := true ifTrue: [ 1 ]. ^ a' return: 1.\x0a\x09self should: 'foo | a | a := false ifTrue: [ 1 ]. ^ a' return: nil.\x0a\x0a\x09self should: 'foo | a | ^ a := true ifTrue: [ 1 ]' return: 1 ",
|
125
|
+
messageSends: ["should:return:"],
|
126
|
+
referencedClasses: []
|
127
|
+
}),
|
128
|
+
smalltalk.CodeGeneratorTest);
|
129
|
+
|
130
|
+
smalltalk.addMethod(
|
131
|
+
"_testBlockReturn",
|
132
|
+
smalltalk.method({
|
133
|
+
selector: "testBlockReturn",
|
134
|
+
category: 'tests',
|
135
|
+
fn: function () {
|
136
|
+
var self = this;
|
137
|
+
smalltalk.send(self, "_should_return_", ["foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]", [2, 3, 4]]);
|
138
|
+
smalltalk.send(self, "_should_return_", ["foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]", [2, 3, 4]]);
|
139
|
+
smalltalk.send(self, "_should_return_", ["foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]", [2, 1, 4]]);
|
140
|
+
return self;
|
141
|
+
},
|
142
|
+
args: [],
|
143
|
+
source: "testBlockReturn\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]' return: #(2 1 4).",
|
144
|
+
messageSends: ["should:return:"],
|
145
|
+
referencedClasses: []
|
146
|
+
}),
|
147
|
+
smalltalk.CodeGeneratorTest);
|
148
|
+
|
149
|
+
smalltalk.addMethod(
|
150
|
+
"_testCascades",
|
151
|
+
smalltalk.method({
|
152
|
+
selector: "testCascades",
|
153
|
+
category: 'tests',
|
154
|
+
fn: function () {
|
155
|
+
var self = this;
|
156
|
+
smalltalk.send(self, "_should_return_", ["foo ^ Array new add: 3; add: 4; yourself", [3, 4]]);
|
157
|
+
return self;
|
158
|
+
},
|
159
|
+
args: [],
|
160
|
+
source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
|
161
|
+
messageSends: ["should:return:"],
|
162
|
+
referencedClasses: []
|
163
|
+
}),
|
164
|
+
smalltalk.CodeGeneratorTest);
|
165
|
+
|
166
|
+
smalltalk.addMethod(
|
167
|
+
"_testLiterals",
|
168
|
+
smalltalk.method({
|
169
|
+
selector: "testLiterals",
|
170
|
+
category: 'tests',
|
171
|
+
fn: function () {
|
172
|
+
var self = this;
|
173
|
+
smalltalk.send(self, "_should_return_", ["foo ^ 1", 1]);
|
174
|
+
smalltalk.send(self, "_should_return_", ["foo ^ 'hello'", "hello"]);
|
175
|
+
smalltalk.send(self, "_should_return_", ["foo ^ #(1 2 3 4)", [1, 2, 3, 4]]);
|
176
|
+
smalltalk.send(self, "_should_return_", ["foo ^ {1. [:x | x ] value: 2. 3. [4] value}", [1, 2, 3, 4]]);
|
177
|
+
smalltalk.send(self, "_should_return_", ["foo ^ true", true]);
|
178
|
+
smalltalk.send(self, "_should_return_", ["foo ^ false", false]);
|
179
|
+
smalltalk.send(self, "_should_return_", ["foo ^ #{1->2. 3->4}", smalltalk.HashedCollection._fromPairs_([smalltalk.send(1, "__minus_gt", [2]), smalltalk.send(3, "__minus_gt", [4])])]);
|
180
|
+
smalltalk.send(self, "_should_return_", ["foo ^ #hello", smalltalk.symbolFor("hello")]);
|
181
|
+
smalltalk.send(self, "_should_return_", ["foo ^ -123.456", -123.456]);
|
182
|
+
return self;
|
183
|
+
},
|
184
|
+
args: [],
|
185
|
+
source: "testLiterals\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ ''hello''' return: 'hello'.\x0a\x09self should: 'foo ^ #(1 2 3 4)' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ {1. [:x | x ] value: 2. 3. [4] value}' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ true' return: true.\x0a\x09self should: 'foo ^ false' return: false.\x0a\x09self should: 'foo ^ #{1->2. 3->4}' return: #{1->2. 3->4}.\x0a\x09self should: 'foo ^ #hello' return: #hello.\x0a\x09self should: 'foo ^ -123.456' return: -123.456",
|
186
|
+
messageSends: ["should:return:", "->"],
|
187
|
+
referencedClasses: []
|
188
|
+
}),
|
189
|
+
smalltalk.CodeGeneratorTest);
|
190
|
+
|
191
|
+
smalltalk.addMethod(
|
192
|
+
"_testLocalReturn",
|
193
|
+
smalltalk.method({
|
194
|
+
selector: "testLocalReturn",
|
195
|
+
category: 'tests',
|
196
|
+
fn: function () {
|
197
|
+
var self = this;
|
198
|
+
smalltalk.send(self, "_should_return_", ["foo ^ 1", 1]);
|
199
|
+
smalltalk.send(self, "_should_return_", ["foo ^ 1 + 1", 2]);
|
200
|
+
smalltalk.send(self, "_should_return_", ["foo ", self['@receiver']]);
|
201
|
+
smalltalk.send(self, "_should_return_", ["foo self asString", self['@receiver']]);
|
202
|
+
smalltalk.send(self, "_should_return_", ["foo | a b | a := 1. b := 2. ^ a + b", 3]);
|
203
|
+
return self;
|
204
|
+
},
|
205
|
+
args: [],
|
206
|
+
source: "testLocalReturn\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ' return: receiver.\x0a\x09self should: 'foo self asString' return: receiver.\x0a\x09self should: 'foo | a b | a := 1. b := 2. ^ a + b' return: 3",
|
207
|
+
messageSends: ["should:return:"],
|
208
|
+
referencedClasses: []
|
209
|
+
}),
|
210
|
+
smalltalk.CodeGeneratorTest);
|
211
|
+
|
212
|
+
smalltalk.addMethod(
|
213
|
+
"_testMessageSends",
|
214
|
+
smalltalk.method({
|
215
|
+
selector: "testMessageSends",
|
216
|
+
category: 'tests',
|
217
|
+
fn: function () {
|
218
|
+
var self = this;
|
219
|
+
smalltalk.send(self, "_should_return_", ["foo ^ 1 asString", "1"]);
|
220
|
+
smalltalk.send(self, "_should_return_", ["foo ^ 1 + 1", 2]);
|
221
|
+
smalltalk.send(self, "_should_return_", ["foo ^ 1 + 2 * 3", 9]);
|
222
|
+
smalltalk.send(self, "_should_return_", ["foo ^ 1 to: 3", [1, 2, 3]]);
|
223
|
+
smalltalk.send(self, "_should_return_", ["foo ^ 1 to: 5 by: 2", [1, 3, 5]]);
|
224
|
+
return self;
|
225
|
+
},
|
226
|
+
args: [],
|
227
|
+
source: "testMessageSends\x0a\x09self should: 'foo ^ 1 asString' return: '1'.\x0a\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ^ 1 + 2 * 3' return: 9.\x0a\x0a\x09self should: 'foo ^ 1 to: 3' return: #(1 2 3).\x0a\x09self should: 'foo ^ 1 to: 5 by: 2' return: #(1 3 5)",
|
228
|
+
messageSends: ["should:return:"],
|
229
|
+
referencedClasses: []
|
230
|
+
}),
|
231
|
+
smalltalk.CodeGeneratorTest);
|
232
|
+
|
233
|
+
smalltalk.addMethod(
|
234
|
+
"_testNestedIfTrue",
|
235
|
+
smalltalk.method({
|
236
|
+
selector: "testNestedIfTrue",
|
237
|
+
category: 'tests',
|
238
|
+
fn: function () {
|
239
|
+
var self = this;
|
240
|
+
smalltalk.send(self, "_should_return_", ["foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]", 1]);
|
241
|
+
smalltalk.send(self, "_should_return_", ["foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]", nil]);
|
242
|
+
smalltalk.send(self, "_should_return_", ["foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]", 1]);
|
243
|
+
smalltalk.send(self, "_should_return_", ["foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]", self['@receiver']]);
|
244
|
+
return self;
|
245
|
+
},
|
246
|
+
args: [],
|
247
|
+
source: "testNestedIfTrue\x0a\x09self should: 'foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]' return: nil.\x0a\x0a\x09self should: 'foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]' return: 1.\x0a\x09self should: 'foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]' return: receiver.",
|
248
|
+
messageSends: ["should:return:"],
|
249
|
+
referencedClasses: []
|
250
|
+
}),
|
251
|
+
smalltalk.CodeGeneratorTest);
|
252
|
+
|
253
|
+
smalltalk.addMethod(
|
254
|
+
"_testNonLocalReturn",
|
255
|
+
smalltalk.method({
|
256
|
+
selector: "testNonLocalReturn",
|
257
|
+
category: 'tests',
|
258
|
+
fn: function () {
|
259
|
+
var self = this;
|
260
|
+
smalltalk.send(self, "_should_return_", ["foo [ ^ 1 ] value", 1]);
|
261
|
+
smalltalk.send(self, "_should_return_", ["foo [ ^ 1 + 1 ] value", 2]);
|
262
|
+
smalltalk.send(self, "_should_return_", ["foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt", 3]);
|
263
|
+
smalltalk.send(self, "_should_return_", ["foo [ :x | ^ x + x ] value: 4. ^ 2", 8]);
|
264
|
+
return self;
|
265
|
+
},
|
266
|
+
args: [],
|
267
|
+
source: "testNonLocalReturn\x0a\x09self should: 'foo [ ^ 1 ] value' return: 1.\x0a\x09self should: 'foo [ ^ 1 + 1 ] value' return: 2.\x0a\x09self should: 'foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt' return: 3.\x0a\x09self should: 'foo [ :x | ^ x + x ] value: 4. ^ 2' return: 8",
|
268
|
+
messageSends: ["should:return:"],
|
269
|
+
referencedClasses: []
|
270
|
+
}),
|
271
|
+
smalltalk.CodeGeneratorTest);
|
272
|
+
|
273
|
+
smalltalk.addMethod(
|
274
|
+
"_testifFalse",
|
275
|
+
smalltalk.method({
|
276
|
+
selector: "testifFalse",
|
277
|
+
category: 'tests',
|
278
|
+
fn: function () {
|
279
|
+
var self = this;
|
280
|
+
smalltalk.send(self, "_should_return_", ["foo true ifFalse: [ ^ 1 ]", self['@receiver']]);
|
281
|
+
smalltalk.send(self, "_should_return_", ["foo false ifFalse: [ ^ 2 ]", 2]);
|
282
|
+
smalltalk.send(self, "_should_return_", ["foo ^ true ifFalse: [ 1 ]", nil]);
|
283
|
+
smalltalk.send(self, "_should_return_", ["foo ^ false ifFalse: [ 2 ]", 2]);
|
284
|
+
return self;
|
285
|
+
},
|
286
|
+
args: [],
|
287
|
+
source: "testifFalse\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ]' return: 2.",
|
288
|
+
messageSends: ["should:return:"],
|
289
|
+
referencedClasses: []
|
290
|
+
}),
|
291
|
+
smalltalk.CodeGeneratorTest);
|
292
|
+
|
293
|
+
smalltalk.addMethod(
|
294
|
+
"_testifFalseIfTrue",
|
295
|
+
smalltalk.method({
|
296
|
+
selector: "testifFalseIfTrue",
|
297
|
+
category: 'tests',
|
298
|
+
fn: function () {
|
299
|
+
var self = this;
|
300
|
+
smalltalk.send(self, "_should_return_", ["foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]", 2]);
|
301
|
+
smalltalk.send(self, "_should_return_", ["foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]", 2]);
|
302
|
+
smalltalk.send(self, "_should_return_", ["foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]", 2]);
|
303
|
+
smalltalk.send(self, "_should_return_", ["foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]", 2]);
|
304
|
+
return self;
|
305
|
+
},
|
306
|
+
args: [],
|
307
|
+
source: "testifFalseIfTrue\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]' return: 2.",
|
308
|
+
messageSends: ["should:return:"],
|
309
|
+
referencedClasses: []
|
310
|
+
}),
|
311
|
+
smalltalk.CodeGeneratorTest);
|
312
|
+
|
313
|
+
smalltalk.addMethod(
|
314
|
+
"_testifNil",
|
315
|
+
smalltalk.method({
|
316
|
+
selector: "testifNil",
|
317
|
+
category: 'tests',
|
318
|
+
fn: function () {
|
319
|
+
var self = this;
|
320
|
+
smalltalk.send(self, "_should_return_", ["foo ^ 1 ifNil: [ 2 ]", 1]);
|
321
|
+
smalltalk.send(self, "_should_return_", ["foo ^ nil ifNil: [ 2 ]", 2]);
|
322
|
+
smalltalk.send(self, "_should_return_", ["foo 1 ifNil: [ ^ 2 ]", self['@receiver']]);
|
323
|
+
smalltalk.send(self, "_should_return_", ["foo nil ifNil: [ ^ 2 ]", 2]);
|
324
|
+
return self;
|
325
|
+
},
|
326
|
+
args: [],
|
327
|
+
source: "testifNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ]' return: receiver.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ]' return: 2.",
|
328
|
+
messageSends: ["should:return:"],
|
329
|
+
referencedClasses: []
|
330
|
+
}),
|
331
|
+
smalltalk.CodeGeneratorTest);
|
332
|
+
|
333
|
+
smalltalk.addMethod(
|
334
|
+
"_testifNilIfNotNil",
|
335
|
+
smalltalk.method({
|
336
|
+
selector: "testifNilIfNotNil",
|
337
|
+
category: 'tests',
|
338
|
+
fn: function () {
|
339
|
+
var self = this;
|
340
|
+
smalltalk.send(self, "_should_return_", ["foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]", 3]);
|
341
|
+
smalltalk.send(self, "_should_return_", ["foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]", 2]);
|
342
|
+
smalltalk.send(self, "_should_return_", ["foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]", 3]);
|
343
|
+
smalltalk.send(self, "_should_return_", ["foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]", 2]);
|
344
|
+
return self;
|
345
|
+
},
|
346
|
+
args: [],
|
347
|
+
source: "testifNilIfNotNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 3.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 2.",
|
348
|
+
messageSends: ["should:return:"],
|
349
|
+
referencedClasses: []
|
350
|
+
}),
|
351
|
+
smalltalk.CodeGeneratorTest);
|
352
|
+
|
353
|
+
smalltalk.addMethod(
|
354
|
+
"_testifNotNil",
|
355
|
+
smalltalk.method({
|
356
|
+
selector: "testifNotNil",
|
357
|
+
category: 'tests',
|
358
|
+
fn: function () {
|
359
|
+
var self = this;
|
360
|
+
smalltalk.send(self, "_should_return_", ["foo ^ 1 ifNotNil: [ 2 ]", 2]);
|
361
|
+
smalltalk.send(self, "_should_return_", ["foo ^ nil ifNotNil: [ 2 ]", nil]);
|
362
|
+
smalltalk.send(self, "_should_return_", ["foo 1 ifNotNil: [ ^ 2 ]", 2]);
|
363
|
+
smalltalk.send(self, "_should_return_", ["foo nil ifNotNil: [ ^ 2 ]", self['@receiver']]);
|
364
|
+
return self;
|
365
|
+
},
|
366
|
+
args: [],
|
367
|
+
source: "testifNotNil\x0a\x09self should: 'foo ^ 1 ifNotNil: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ nil ifNotNil: [ 2 ]' return: nil.\x0a\x0a\x09self should: 'foo 1 ifNotNil: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo nil ifNotNil: [ ^ 2 ]' return: receiver.",
|
368
|
+
messageSends: ["should:return:"],
|
369
|
+
referencedClasses: []
|
370
|
+
}),
|
371
|
+
smalltalk.CodeGeneratorTest);
|
372
|
+
|
373
|
+
smalltalk.addMethod(
|
374
|
+
"_testifTrue",
|
375
|
+
smalltalk.method({
|
376
|
+
selector: "testifTrue",
|
377
|
+
category: 'tests',
|
378
|
+
fn: function () {
|
379
|
+
var self = this;
|
380
|
+
smalltalk.send(self, "_should_return_", ["foo false ifTrue: [ ^ 1 ]", self['@receiver']]);
|
381
|
+
smalltalk.send(self, "_should_return_", ["foo true ifTrue: [ ^ 2 ]", 2]);
|
382
|
+
smalltalk.send(self, "_should_return_", ["foo ^ false ifTrue: [ 1 ]", nil]);
|
383
|
+
smalltalk.send(self, "_should_return_", ["foo ^ true ifTrue: [ 2 ]", 2]);
|
384
|
+
return self;
|
385
|
+
},
|
386
|
+
args: [],
|
387
|
+
source: "testifTrue\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo true ifTrue: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ]' return: 2.",
|
388
|
+
messageSends: ["should:return:"],
|
389
|
+
referencedClasses: []
|
390
|
+
}),
|
391
|
+
smalltalk.CodeGeneratorTest);
|
392
|
+
|
393
|
+
smalltalk.addMethod(
|
394
|
+
"_testifTrueIfFalse",
|
395
|
+
smalltalk.method({
|
396
|
+
selector: "testifTrueIfFalse",
|
397
|
+
category: 'tests',
|
398
|
+
fn: function () {
|
399
|
+
var self = this;
|
400
|
+
smalltalk.send(self, "_should_return_", ["foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]", 2]);
|
401
|
+
smalltalk.send(self, "_should_return_", ["foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]", 1]);
|
402
|
+
smalltalk.send(self, "_should_return_", ["foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]", 1]);
|
403
|
+
smalltalk.send(self, "_should_return_", ["foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]", 2]);
|
404
|
+
return self;
|
405
|
+
},
|
406
|
+
args: [],
|
407
|
+
source: "testifTrueIfFalse\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]' return: 2.\x0a\x09self should: 'foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]' return: 1.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 2.",
|
408
|
+
messageSends: ["should:return:"],
|
409
|
+
referencedClasses: []
|
410
|
+
}),
|
411
|
+
smalltalk.CodeGeneratorTest);
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
smalltalk.addClass('InliningCodeGeneratorTest', smalltalk.CodeGeneratorTest, [], 'Compiler-Tests');
|
416
|
+
smalltalk.addMethod(
|
417
|
+
"_codeGeneratorClass",
|
418
|
+
smalltalk.method({
|
419
|
+
selector: "codeGeneratorClass",
|
420
|
+
category: 'accessing',
|
421
|
+
fn: function () {
|
422
|
+
var self = this;
|
423
|
+
return smalltalk.InliningCodeGenerator || InliningCodeGenerator;
|
424
|
+
},
|
425
|
+
args: [],
|
426
|
+
source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
|
427
|
+
messageSends: [],
|
428
|
+
referencedClasses: ["InliningCodeGenerator"]
|
429
|
+
}),
|
430
|
+
smalltalk.InliningCodeGeneratorTest);
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
smalltalk.addClass('ScopeVarTest', smalltalk.TestCase, [], 'Compiler-Tests');
|
435
|
+
smalltalk.addMethod(
|
436
|
+
"_testClassRefVar",
|
437
|
+
smalltalk.method({
|
438
|
+
selector: "testClassRefVar",
|
439
|
+
category: 'tests',
|
440
|
+
fn: function () {
|
441
|
+
var self = this;
|
442
|
+
var $1, $2;
|
443
|
+
var node;
|
444
|
+
$1 = smalltalk.send(smalltalk.ClassReferenceNode || ClassReferenceNode, "_new", []);
|
445
|
+
smalltalk.send($1, "_value_", ["Object"]);
|
446
|
+
$2 = smalltalk.send($1, "_yourself", []);
|
447
|
+
node = $2;
|
448
|
+
smalltalk.send(smalltalk.send(smalltalk.SemanticAnalyzer || SemanticAnalyzer, "_new", []), "_visit_", [node]);
|
449
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(node, "_binding", []), "_isClassRefVar", [])]);
|
450
|
+
return self;
|
451
|
+
},
|
452
|
+
args: [],
|
453
|
+
source: "testClassRefVar\x0a\x09| node |\x0a\x09node := ClassReferenceNode new\x0a\x09\x09value: 'Object';\x0a\x09\x09yourself.\x0a\x09SemanticAnalyzer new visit: node.\x0a\x09self assert: node binding isClassRefVar",
|
454
|
+
messageSends: ["value:", "new", "yourself", "visit:", "assert:", "isClassRefVar", "binding"],
|
455
|
+
referencedClasses: ["ClassReferenceNode", "SemanticAnalyzer"]
|
456
|
+
}),
|
457
|
+
smalltalk.ScopeVarTest);
|
458
|
+
|
459
|
+
smalltalk.addMethod(
|
460
|
+
"_testInstanceVar",
|
461
|
+
smalltalk.method({
|
462
|
+
selector: "testInstanceVar",
|
463
|
+
category: 'tests',
|
464
|
+
fn: function () {
|
465
|
+
var self = this;
|
466
|
+
var $1, $2;
|
467
|
+
var node;
|
468
|
+
var scope;
|
469
|
+
$1 = smalltalk.send(smalltalk.VariableNode || VariableNode, "_new", []);
|
470
|
+
smalltalk.send($1, "_value_", ["bzzz"]);
|
471
|
+
$2 = smalltalk.send($1, "_yourself", []);
|
472
|
+
node = $2;
|
473
|
+
scope = smalltalk.send(smalltalk.MethodLexicalScope || MethodLexicalScope, "_new", []);
|
474
|
+
smalltalk.send(scope, "_addIVar_", ["bzzz"]);
|
475
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(scope, "_bindingFor_", [node]), "_isInstanceVar", [])]);
|
476
|
+
return self;
|
477
|
+
},
|
478
|
+
args: [],
|
479
|
+
source: "testInstanceVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addIVar: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isInstanceVar",
|
480
|
+
messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"],
|
481
|
+
referencedClasses: ["VariableNode", "MethodLexicalScope"]
|
482
|
+
}),
|
483
|
+
smalltalk.ScopeVarTest);
|
484
|
+
|
485
|
+
smalltalk.addMethod(
|
486
|
+
"_testPseudoVar",
|
487
|
+
smalltalk.method({
|
488
|
+
selector: "testPseudoVar",
|
489
|
+
category: 'tests',
|
490
|
+
fn: function () {
|
491
|
+
var self = this;
|
492
|
+
var $1, $2;
|
493
|
+
var node;
|
494
|
+
var pseudoVars;
|
495
|
+
pseudoVars = ["self", "super", "true", "false", "nil"];
|
496
|
+
smalltalk.send(pseudoVars, "_do_", [function (each) {$1 = smalltalk.send(smalltalk.VariableNode || VariableNode, "_new", []);smalltalk.send($1, "_value_", [each]);$2 = smalltalk.send($1, "_yourself", []);node = $2;node;return smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.MethodLexicalScope || MethodLexicalScope, "_new", []), "_bindingFor_", [node]), "_isPseudoVar", [])]);}]);
|
497
|
+
return self;
|
498
|
+
},
|
44
499
|
args: [],
|
45
|
-
source: "
|
46
|
-
messageSends: ["
|
47
|
-
referencedClasses: ["
|
500
|
+
source: "testPseudoVar\x0a\x09| node pseudoVars |\x0a\x09pseudoVars := #('self' 'super' 'true' 'false' 'nil').\x0a\x09pseudoVars do: [:each |\x0a\x09\x09node := VariableNode new\x0a\x09\x09value: each;\x0a\x09\x09yourself.\x0a\x09\x09self assert: (MethodLexicalScope new bindingFor: node) isPseudoVar ]",
|
501
|
+
messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"],
|
502
|
+
referencedClasses: ["VariableNode", "MethodLexicalScope"]
|
48
503
|
}),
|
49
|
-
smalltalk.
|
504
|
+
smalltalk.ScopeVarTest);
|
50
505
|
|
506
|
+
smalltalk.addMethod(
|
507
|
+
"_testTempVar",
|
508
|
+
smalltalk.method({
|
509
|
+
selector: "testTempVar",
|
510
|
+
category: 'tests',
|
511
|
+
fn: function () {
|
512
|
+
var self = this;
|
513
|
+
var $1, $2;
|
514
|
+
var node;
|
515
|
+
var scope;
|
516
|
+
$1 = smalltalk.send(smalltalk.VariableNode || VariableNode, "_new", []);
|
517
|
+
smalltalk.send($1, "_value_", ["bzzz"]);
|
518
|
+
$2 = smalltalk.send($1, "_yourself", []);
|
519
|
+
node = $2;
|
520
|
+
scope = smalltalk.send(smalltalk.MethodLexicalScope || MethodLexicalScope, "_new", []);
|
521
|
+
smalltalk.send(scope, "_addTemp_", ["bzzz"]);
|
522
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(scope, "_bindingFor_", [node]), "_isTempVar", [])]);
|
523
|
+
return self;
|
524
|
+
},
|
525
|
+
args: [],
|
526
|
+
source: "testTempVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addTemp: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isTempVar",
|
527
|
+
messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"],
|
528
|
+
referencedClasses: ["VariableNode", "MethodLexicalScope"]
|
529
|
+
}),
|
530
|
+
smalltalk.ScopeVarTest);
|
531
|
+
|
532
|
+
smalltalk.addMethod(
|
533
|
+
"_testUnknownVar",
|
534
|
+
smalltalk.method({
|
535
|
+
selector: "testUnknownVar",
|
536
|
+
category: 'tests',
|
537
|
+
fn: function () {
|
538
|
+
var self = this;
|
539
|
+
var $1, $2;
|
540
|
+
var node;
|
541
|
+
$1 = smalltalk.send(smalltalk.VariableNode || VariableNode, "_new", []);
|
542
|
+
smalltalk.send($1, "_value_", ["bzzz"]);
|
543
|
+
$2 = smalltalk.send($1, "_yourself", []);
|
544
|
+
node = $2;
|
545
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.MethodLexicalScope || MethodLexicalScope, "_new", []), "_bindingFor_", [node]), "_isNil", [])]);
|
546
|
+
return self;
|
547
|
+
},
|
548
|
+
args: [],
|
549
|
+
source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
|
550
|
+
messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"],
|
551
|
+
referencedClasses: ["VariableNode", "MethodLexicalScope"]
|
552
|
+
}),
|
553
|
+
smalltalk.ScopeVarTest);
|
554
|
+
|
555
|
+
|
556
|
+
|
557
|
+
smalltalk.addClass('SemanticAnalyzerTest', smalltalk.TestCase, ['analyzer'], 'Compiler-Tests');
|
51
558
|
smalltalk.addMethod(
|
52
559
|
"_setUp",
|
53
560
|
smalltalk.method({
|
54
561
|
selector: "setUp",
|
55
562
|
category: 'running',
|
56
|
-
fn: function (){
|
57
|
-
var self=this;
|
58
|
-
smalltalk.send(
|
59
|
-
|
60
|
-
|
563
|
+
fn: function () {
|
564
|
+
var self = this;
|
565
|
+
self['@analyzer'] = smalltalk.send(smalltalk.SemanticAnalyzer || SemanticAnalyzer, "_on_", [smalltalk.Object || Object]);
|
566
|
+
return self;
|
567
|
+
},
|
61
568
|
args: [],
|
62
|
-
source: "setUp\x0a\
|
63
|
-
messageSends: ["
|
569
|
+
source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
|
570
|
+
messageSends: ["on:"],
|
571
|
+
referencedClasses: ["Object", "SemanticAnalyzer"]
|
572
|
+
}),
|
573
|
+
smalltalk.SemanticAnalyzerTest);
|
574
|
+
|
575
|
+
smalltalk.addMethod(
|
576
|
+
"_testAssignment",
|
577
|
+
smalltalk.method({
|
578
|
+
selector: "testAssignment",
|
579
|
+
category: 'tests',
|
580
|
+
fn: function () {
|
581
|
+
var self = this;
|
582
|
+
var src;
|
583
|
+
var ast;
|
584
|
+
src = "foo self := 1";
|
585
|
+
ast = smalltalk.send(smalltalk, "_parse_", [src]);
|
586
|
+
smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(self['@analyzer'], "_visit_", [ast]);}, smalltalk.InvalidAssignmentError || InvalidAssignmentError]);
|
587
|
+
return self;
|
588
|
+
},
|
589
|
+
args: [],
|
590
|
+
source: "testAssignment\x0a\x09| src ast |\x0a\x0a\x09src := 'foo self := 1'.\x0a\x09ast := smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: InvalidAssignmentError",
|
591
|
+
messageSends: ["parse:", "should:raise:", "visit:"],
|
592
|
+
referencedClasses: ["InvalidAssignmentError"]
|
593
|
+
}),
|
594
|
+
smalltalk.SemanticAnalyzerTest);
|
595
|
+
|
596
|
+
smalltalk.addMethod(
|
597
|
+
"_testNonLocalReturn",
|
598
|
+
smalltalk.method({
|
599
|
+
selector: "testNonLocalReturn",
|
600
|
+
category: 'tests',
|
601
|
+
fn: function () {
|
602
|
+
var self = this;
|
603
|
+
var src;
|
604
|
+
var ast;
|
605
|
+
src = "foo | a | a + 1. ^ a";
|
606
|
+
ast = smalltalk.send(smalltalk, "_parse_", [src]);
|
607
|
+
smalltalk.send(self['@analyzer'], "_visit_", [ast]);
|
608
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(ast, "_scope", []), "_hasNonLocalReturn", [])]);
|
609
|
+
return self;
|
610
|
+
},
|
611
|
+
args: [],
|
612
|
+
source: "testNonLocalReturn\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. ^ a'.\x0a\x09ast := smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast scope hasNonLocalReturn",
|
613
|
+
messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"],
|
64
614
|
referencedClasses: []
|
65
615
|
}),
|
66
|
-
smalltalk.
|
616
|
+
smalltalk.SemanticAnalyzerTest);
|
67
617
|
|
68
618
|
smalltalk.addMethod(
|
69
|
-
"
|
619
|
+
"_testNonLocalReturn2",
|
70
620
|
smalltalk.method({
|
71
|
-
selector: "
|
72
|
-
category: '
|
73
|
-
fn: function (){
|
74
|
-
var self=this;
|
75
|
-
|
76
|
-
|
77
|
-
|
621
|
+
selector: "testNonLocalReturn2",
|
622
|
+
category: 'tests',
|
623
|
+
fn: function () {
|
624
|
+
var self = this;
|
625
|
+
var src;
|
626
|
+
var ast;
|
627
|
+
src = "foo | a | a + 1. [\xA0[ ^ a]\xA0]";
|
628
|
+
ast = smalltalk.send(smalltalk, "_parse_", [src]);
|
629
|
+
smalltalk.send(self['@analyzer'], "_visit_", [ast]);
|
630
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(ast, "_scope", []), "_hasNonLocalReturn", [])]);
|
631
|
+
return self;
|
632
|
+
},
|
78
633
|
args: [],
|
79
|
-
source: "
|
80
|
-
messageSends: ["
|
634
|
+
source: "testNonLocalReturn2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ ^ a] ]'.\x0a\x09ast := smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope hasNonLocalReturn",
|
635
|
+
messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"],
|
81
636
|
referencedClasses: []
|
82
637
|
}),
|
83
|
-
smalltalk.
|
638
|
+
smalltalk.SemanticAnalyzerTest);
|
84
639
|
|
85
640
|
smalltalk.addMethod(
|
86
|
-
"
|
641
|
+
"_testScope",
|
87
642
|
smalltalk.method({
|
88
|
-
selector: "
|
643
|
+
selector: "testScope",
|
89
644
|
category: 'tests',
|
90
|
-
fn: function (){
|
91
|
-
var self=this;
|
92
|
-
|
93
|
-
|
94
|
-
|
645
|
+
fn: function () {
|
646
|
+
var self = this;
|
647
|
+
var src;
|
648
|
+
var ast;
|
649
|
+
src = "foo | a | a + 1. [ | b | b := a ]";
|
650
|
+
ast = smalltalk.send(smalltalk, "_parse_", [src]);
|
651
|
+
smalltalk.send(self['@analyzer'], "_visit_", [ast]);
|
652
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(ast, "_nodes", []), "_first", []), "_nodes", []), "_last", []), "_scope", []), "__eq_eq", [smalltalk.send(ast, "_scope", [])])]);
|
653
|
+
return self;
|
654
|
+
},
|
95
655
|
args: [],
|
96
|
-
source: "
|
97
|
-
messageSends: ["
|
98
|
-
referencedClasses: [
|
656
|
+
source: "testScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast nodes first nodes last scope == ast scope.",
|
657
|
+
messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "nodes", "first"],
|
658
|
+
referencedClasses: []
|
99
659
|
}),
|
100
|
-
smalltalk.
|
660
|
+
smalltalk.SemanticAnalyzerTest);
|
101
661
|
|
102
662
|
smalltalk.addMethod(
|
103
|
-
"
|
663
|
+
"_testScope2",
|
104
664
|
smalltalk.method({
|
105
|
-
selector: "
|
665
|
+
selector: "testScope2",
|
106
666
|
category: 'tests',
|
107
|
-
fn: function (){
|
108
|
-
var self=this;
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
667
|
+
fn: function () {
|
668
|
+
var self = this;
|
669
|
+
var src;
|
670
|
+
var ast;
|
671
|
+
src = "foo | a | a + 1. [ [ | b | b := a\xA0] ]";
|
672
|
+
ast = smalltalk.send(smalltalk, "_parse_", [src]);
|
673
|
+
smalltalk.send(self['@analyzer'], "_visit_", [ast]);
|
674
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(ast, "_nodes", []), "_first", []), "_nodes", []), "_last", []), "_nodes", []), "_first", []), "_nodes", []), "_first", []), "_scope", []), "__eq_eq", [smalltalk.send(ast, "_scope", [])])]);
|
675
|
+
return self;
|
676
|
+
},
|
113
677
|
args: [],
|
114
|
-
source: "
|
115
|
-
messageSends: ["
|
116
|
-
referencedClasses: [
|
678
|
+
source: "testScope2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast nodes first nodes last nodes first nodes first scope == ast scope.",
|
679
|
+
messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "nodes", "last"],
|
680
|
+
referencedClasses: []
|
117
681
|
}),
|
118
|
-
smalltalk.
|
682
|
+
smalltalk.SemanticAnalyzerTest);
|
119
683
|
|
684
|
+
smalltalk.addMethod(
|
685
|
+
"_testScopeLevel",
|
686
|
+
smalltalk.method({
|
687
|
+
selector: "testScopeLevel",
|
688
|
+
category: 'tests',
|
689
|
+
fn: function () {
|
690
|
+
var self = this;
|
691
|
+
var src;
|
692
|
+
var ast;
|
693
|
+
src = "foo | a | a + 1. [ [ | b | b := a\xA0] ]";
|
694
|
+
ast = smalltalk.send(smalltalk, "_parse_", [src]);
|
695
|
+
smalltalk.send(self['@analyzer'], "_visit_", [ast]);
|
696
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(ast, "_scope", []), "_scopeLevel", []), "__eq", [1])]);
|
697
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(ast, "_nodes", []), "_first", []), "_nodes", []), "_last", []), "_nodes", []), "_first", []), "_nodes", []), "_first", []), "_scope", []), "_scopeLevel", []), "__eq", [3])]);
|
698
|
+
return self;
|
699
|
+
},
|
700
|
+
args: [],
|
701
|
+
source: "testScopeLevel\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope scopeLevel = 1.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first scope scopeLevel = 3",
|
702
|
+
messageSends: ["parse:", "visit:", "assert:", "=", "scopeLevel", "scope", "first", "nodes", "last"],
|
703
|
+
referencedClasses: []
|
704
|
+
}),
|
705
|
+
smalltalk.SemanticAnalyzerTest);
|
120
706
|
|
707
|
+
smalltalk.addMethod(
|
708
|
+
"_testUnknownVariables",
|
709
|
+
smalltalk.method({
|
710
|
+
selector: "testUnknownVariables",
|
711
|
+
category: 'tests',
|
712
|
+
fn: function () {
|
713
|
+
var self = this;
|
714
|
+
var src;
|
715
|
+
var ast;
|
716
|
+
src = "foo | a | b + a";
|
717
|
+
ast = smalltalk.send(smalltalk, "_parse_", [src]);
|
718
|
+
smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(self['@analyzer'], "_visit_", [ast]);}, smalltalk.UnknownVariableError || UnknownVariableError]);
|
719
|
+
return self;
|
720
|
+
},
|
721
|
+
args: [],
|
722
|
+
source: "testUnknownVariables\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | b + a'.\x0a\x09ast := smalltalk parse: src.\x0a\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError",
|
723
|
+
messageSends: ["parse:", "should:raise:", "visit:"],
|
724
|
+
referencedClasses: ["UnknownVariableError"]
|
725
|
+
}),
|
726
|
+
smalltalk.SemanticAnalyzerTest);
|
121
727
|
|
122
728
|
smalltalk.addMethod(
|
123
|
-
"
|
729
|
+
"_testUnknownVariablesDefinedInJS",
|
124
730
|
smalltalk.method({
|
125
|
-
selector: "
|
126
|
-
category: '
|
127
|
-
fn: function (){
|
128
|
-
var self=this;
|
129
|
-
|
130
|
-
return
|
731
|
+
selector: "testUnknownVariablesDefinedInJS",
|
732
|
+
category: 'tests',
|
733
|
+
fn: function () {
|
734
|
+
var self = this;
|
735
|
+
var someVariable = 1;
|
736
|
+
smalltalk.send(self, "_shouldnt_raise_", [function () {return smalltalk.send(smalltalk, "_parse_", ["foo someVariable"]);}, smalltalk.UnknownVariableError || UnknownVariableError]);
|
737
|
+
return self;
|
738
|
+
},
|
131
739
|
args: [],
|
132
|
-
source: "
|
133
|
-
messageSends: [],
|
740
|
+
source: "testUnknownVariablesDefinedInJS\x0a\x0a\x09< var someVariable = 1 >.\x0a\x0a\x09self shouldnt: [ smalltalk parse: 'foo someVariable' ] raise: UnknownVariableError",
|
741
|
+
messageSends: ["shouldnt:raise:", "parse:"],
|
742
|
+
referencedClasses: ["UnknownVariableError"]
|
743
|
+
}),
|
744
|
+
smalltalk.SemanticAnalyzerTest);
|
745
|
+
|
746
|
+
smalltalk.addMethod(
|
747
|
+
"_testUnknownVariablesWithScope",
|
748
|
+
smalltalk.method({
|
749
|
+
selector: "testUnknownVariablesWithScope",
|
750
|
+
category: 'tests',
|
751
|
+
fn: function () {
|
752
|
+
var self = this;
|
753
|
+
var src;
|
754
|
+
var ast;
|
755
|
+
src = "foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
|
756
|
+
ast = smalltalk.send(smalltalk, "_parse_", [src]);
|
757
|
+
smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(self['@analyzer'], "_visit_", [ast]);}, smalltalk.UnknownVariableError || UnknownVariableError]);
|
758
|
+
return self;
|
759
|
+
},
|
760
|
+
args: [],
|
761
|
+
source: "testUnknownVariablesWithScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a b | [ c + 1. [ a + 1. d + 1 ]]'.\x0a\x09ast := smalltalk parse: src.\x0a\x09\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError",
|
762
|
+
messageSends: ["parse:", "should:raise:", "visit:"],
|
763
|
+
referencedClasses: ["UnknownVariableError"]
|
764
|
+
}),
|
765
|
+
smalltalk.SemanticAnalyzerTest);
|
766
|
+
|
767
|
+
smalltalk.addMethod(
|
768
|
+
"_testVariableShadowing",
|
769
|
+
smalltalk.method({
|
770
|
+
selector: "testVariableShadowing",
|
771
|
+
category: 'tests',
|
772
|
+
fn: function () {
|
773
|
+
var self = this;
|
774
|
+
var src;
|
775
|
+
var ast;
|
776
|
+
src = "foo | a | a + 1";
|
777
|
+
ast = smalltalk.send(smalltalk, "_parse_", [src]);
|
778
|
+
smalltalk.send(self['@analyzer'], "_visit_", [ast]);
|
779
|
+
return self;
|
780
|
+
},
|
781
|
+
args: [],
|
782
|
+
source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := smalltalk parse: src.\x0a\x09analyzer visit: ast",
|
783
|
+
messageSends: ["parse:", "visit:"],
|
134
784
|
referencedClasses: []
|
135
785
|
}),
|
136
|
-
smalltalk.
|
786
|
+
smalltalk.SemanticAnalyzerTest);
|
787
|
+
|
788
|
+
smalltalk.addMethod(
|
789
|
+
"_testVariableShadowing2",
|
790
|
+
smalltalk.method({
|
791
|
+
selector: "testVariableShadowing2",
|
792
|
+
category: 'tests',
|
793
|
+
fn: function () {
|
794
|
+
var self = this;
|
795
|
+
var src;
|
796
|
+
var ast;
|
797
|
+
src = "foo | a | a + 1. [ | a | a := 2 ]";
|
798
|
+
ast = smalltalk.send(smalltalk, "_parse_", [src]);
|
799
|
+
smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(self['@analyzer'], "_visit_", [ast]);}, smalltalk.ShadowingVariableError || ShadowingVariableError]);
|
800
|
+
return self;
|
801
|
+
},
|
802
|
+
args: [],
|
803
|
+
source: "testVariableShadowing2\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | a | a := 2 ]'.\x0a\x09ast := smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError",
|
804
|
+
messageSends: ["parse:", "should:raise:", "visit:"],
|
805
|
+
referencedClasses: ["ShadowingVariableError"]
|
806
|
+
}),
|
807
|
+
smalltalk.SemanticAnalyzerTest);
|
808
|
+
|
809
|
+
smalltalk.addMethod(
|
810
|
+
"_testVariableShadowing3",
|
811
|
+
smalltalk.method({
|
812
|
+
selector: "testVariableShadowing3",
|
813
|
+
category: 'tests',
|
814
|
+
fn: function () {
|
815
|
+
var self = this;
|
816
|
+
var src;
|
817
|
+
var ast;
|
818
|
+
src = "foo | a | a + 1. [ | b | b := 2 ]";
|
819
|
+
ast = smalltalk.send(smalltalk, "_parse_", [src]);
|
820
|
+
smalltalk.send(self['@analyzer'], "_visit_", [ast]);
|
821
|
+
return self;
|
822
|
+
},
|
823
|
+
args: [],
|
824
|
+
source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := smalltalk parse: src.\x0a\x09analyzer visit: ast",
|
825
|
+
messageSends: ["parse:", "visit:"],
|
826
|
+
referencedClasses: []
|
827
|
+
}),
|
828
|
+
smalltalk.SemanticAnalyzerTest);
|
829
|
+
|
830
|
+
smalltalk.addMethod(
|
831
|
+
"_testVariableShadowing4",
|
832
|
+
smalltalk.method({
|
833
|
+
selector: "testVariableShadowing4",
|
834
|
+
category: 'tests',
|
835
|
+
fn: function () {
|
836
|
+
var self = this;
|
837
|
+
var src;
|
838
|
+
var ast;
|
839
|
+
src = "foo | a | a + 1. [ [\xA0[ | b | b := 2 ]\xA0]\xA0]";
|
840
|
+
ast = smalltalk.send(smalltalk, "_parse_", [src]);
|
841
|
+
smalltalk.send(self['@analyzer'], "_visit_", [ast]);
|
842
|
+
return self;
|
843
|
+
},
|
844
|
+
args: [],
|
845
|
+
source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := smalltalk parse: src.\x0a\x09analyzer visit: ast",
|
846
|
+
messageSends: ["parse:", "visit:"],
|
847
|
+
referencedClasses: []
|
848
|
+
}),
|
849
|
+
smalltalk.SemanticAnalyzerTest);
|
850
|
+
|
851
|
+
smalltalk.addMethod(
|
852
|
+
"_testVariableShadowing5",
|
853
|
+
smalltalk.method({
|
854
|
+
selector: "testVariableShadowing5",
|
855
|
+
category: 'tests',
|
856
|
+
fn: function () {
|
857
|
+
var self = this;
|
858
|
+
var src;
|
859
|
+
var ast;
|
860
|
+
src = "foo | a | a + 1. [ [\xA0[ | a | a := 2 ]\xA0]\xA0]";
|
861
|
+
ast = smalltalk.send(smalltalk, "_parse_", [src]);
|
862
|
+
smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(self['@analyzer'], "_visit_", [ast]);}, smalltalk.ShadowingVariableError || ShadowingVariableError]);
|
863
|
+
return self;
|
864
|
+
},
|
865
|
+
args: [],
|
866
|
+
source: "testVariableShadowing5\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]'.\x0a\x09ast := smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError",
|
867
|
+
messageSends: ["parse:", "should:raise:", "visit:"],
|
868
|
+
referencedClasses: ["ShadowingVariableError"]
|
869
|
+
}),
|
870
|
+
smalltalk.SemanticAnalyzerTest);
|
871
|
+
|
872
|
+
smalltalk.addMethod(
|
873
|
+
"_testVariablesLookup",
|
874
|
+
smalltalk.method({
|
875
|
+
selector: "testVariablesLookup",
|
876
|
+
category: 'tests',
|
877
|
+
fn: function () {
|
878
|
+
var self = this;
|
879
|
+
var src;
|
880
|
+
var ast;
|
881
|
+
src = "foo | a | a + 1. [ | b | b := a ]";
|
882
|
+
ast = smalltalk.send(smalltalk, "_parse_", [src]);
|
883
|
+
smalltalk.send(self['@analyzer'], "_visit_", [ast]);
|
884
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(ast, "_nodes", []), "_first", []), "_nodes", []), "_first", []), "_receiver", []), "_binding", []), "_isTempVar", [])]);
|
885
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(ast, "_nodes", []), "_first", []), "_nodes", []), "_first", []), "_receiver", []), "_binding", []), "_scope", []), "__eq_eq", [smalltalk.send(ast, "_scope", [])])]);
|
886
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(ast, "_nodes", []), "_first", []), "_nodes", []), "_last", []), "_nodes", []), "_first", []), "_nodes", []), "_first", []), "_left", []), "_binding", []), "_isTempVar", [])]);
|
887
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(ast, "_nodes", []), "_first", []), "_nodes", []), "_last", []), "_nodes", []), "_first", []), "_nodes", []), "_first", []), "_left", []), "_binding", []), "_scope", []), "__eq_eq", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(ast, "_nodes", []), "_first", []), "_nodes", []), "_last", []), "_scope", [])])]);
|
888
|
+
return self;
|
889
|
+
},
|
890
|
+
args: [],
|
891
|
+
source: "testVariablesLookup\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09\x22Binding for `a` in the message send\x22\x0a\x09self assert: ast nodes first nodes first receiver binding isTempVar.\x0a\x09self assert: ast nodes first nodes first receiver binding scope == ast scope.\x0a\x0a\x09\x22Binding for `b`\x22\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding isTempVar.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding scope == ast nodes first nodes last scope.",
|
892
|
+
messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "nodes", "==", "scope", "left", "last"],
|
893
|
+
referencedClasses: []
|
894
|
+
}),
|
895
|
+
smalltalk.SemanticAnalyzerTest);
|
896
|
+
|
897
|
+
|
137
898
|
|