[squeak-dev] The Inbox: Compiler-ct.452.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Nov 13 18:07:33 UTC 2020


A new version of Compiler was added to project The Inbox:
http://source.squeak.org/inbox/Compiler-ct.452.mcz

==================== Summary ====================

Name: Compiler-ct.452
Author: ct
Time: 13 November 2020, 7:07:30.464415 pm
UUID: a40e8327-95c2-f448-8edd-0aa087a5c930
Ancestors: Compiler-eem.451

Reworks public Compiler interface and documentation:

- Parser: Do not use #fail in the event of an internal error unless compilation is interactive. This was a single precedent case.
- Correct description of compilation error handling: failBlock is *not* evaluated any longer if the requestor is nil since I eliminated the above precedent (I validated that twice). Mention SyntaxErrorNotification explicitly instead of referring to the ToolSet-specific SyntaxError tool.
- Provide new convenience selectors #compileNoPattern: and #compileNoPattern:in: on Compiler instance side.
- Unify method comment format and phrases.
- Ban ST80-specific term "controller" from the argument names.

=============== Diff against Compiler-eem.451 ===============

Item was changed:
  ----- Method: Compiler class>>evaluate: (in category 'evaluating') -----
  evaluate: textOrString 
+ 	"See Compiler|evaluate:for:notifying:logged:. If a compilation error occurs, a SyntaxErrorNotification is signaled rather than notifying any requestor.
+ 	Compilation is carried out with respect to nil, i.e., no object, and the invocation is not logged."
- 	"See Compiler|evaluate:for:notifying:logged:. If a compilation error occurs, 
- 	a Syntax Error view is created rather than notifying any requestor. 
- 	Compilation is carried out with respect to nil, i.e., no object, and the 
- 	invocation is not logged."
  
  	^self evaluate: textOrString for: nil!

Item was changed:
  ----- Method: Compiler class>>evaluate:for: (in category 'evaluating') -----
  evaluate: textOrString for: anObject  
+ 	"See Compiler|evaluate:for:notifying:. If a compilation error occurs, a SyntaxErrorNotification is signaled rather than notifying any requestor."
- 	"See Compiler|evaluate:for:notifying:. If a compilation error occurs, 
- 	a Syntax Error view is created rather than notifying any requestor."
  
  	^self evaluate: textOrString for: anObject notifying: nil!

Item was changed:
  ----- Method: Compiler class>>evaluate:for:logged: (in category 'evaluating logged') -----
  evaluate: textOrString for: anObject logged: logFlag 
+ 	"See Compiler|evaluate:for:notifying:logged:. If a compilation error occurs, a SyntaxErrorNotification is signaled rather than notifying any requestor."
- 	"See Compiler|evaluate:for:notifying:logged:. If a compilation error occurs, 
- 	a Syntax Error view is created rather than notifying any requestor."
  
  	^self evaluate: textOrString for: anObject notifying: nil logged: logFlag!

Item was changed:
  ----- Method: Compiler class>>evaluate:for:notifying: (in category 'evaluating') -----
+ evaluate: textOrString for: anObject notifying: requestor
+ 	"Compile and execute the argument, textOrString with respect to the class of anObject. If a compilation error occurs, use requestor for interactive error correction."
- evaluate: textOrString for: anObject notifying: aController
- 	"Compile and execute the argument, textOrString with respect to the class 
- 	of anObject. If a compilation error occurs, notify aController."
  
  	^ self new
  		evaluate: textOrString
  		in: nil
  		to: anObject
+ 		notifying: requestor
- 		notifying: aController
  		ifFail: [^nil]!

Item was changed:
  ----- Method: Compiler class>>evaluate:for:notifying:logged: (in category 'evaluating logged') -----
+ evaluate: textOrString for: anObject notifying: requestor logged: logFlag
+ 	"Compile and execute the argument, textOrString with respect to the class of anObject.
+ 	If a compilation error occurs, use requestor for interactive error correction.
+ 	If both compilation and execution are successful then, if logFlag is true, log (write) the text onto a system changes file so that it can be replayed if necessary."
- evaluate: textOrString for: anObject notifying: aController logged: logFlag
- 	"Compile and execute the argument, textOrString with respect to the class 
- 	of anObject. If a compilation error occurs, notify aController. If both 
- 	compilation and execution are successful then, if logFlag is true, log 
- 	(write) the text onto a system changes file so that it can be replayed if 
- 	necessary."
  
  	^ self new
  				evaluate: textOrString
  				in: nil
  				to: anObject
+ 				notifying: requestor
- 				notifying: aController
  				ifFail: [^nil]
  				logged: logFlag.!

Item was changed:
  ----- Method: Compiler class>>evaluate:in:notifying:logged: (in category 'evaluating logged') -----
+ evaluate: textOrString in: anEnvironment notifying: requestor logged: logFlag
- evaluate: textOrString in: anEnvironment notifying: aController logged: logFlag
  	"Compile and execute the argument, textOrString in anEnvironment.
+ 	If a compilation error occurs, use requestor for interactive error correction.
+ 	If both compilation and execution are successful then, if logFlag is true, log (write) the text onto a system changes file so that it can be replayed if necessary."
- 	If a compilation error occurs, notify aController. If both 
- 	compilation and execution are successful then, if logFlag is true, log 
- 	(write) the text onto a system changes file so that it can be replayed if 
- 	necessary."
  
  	^ self new
  				evaluate: textOrString
  				in: anEnvironment
+ 				notifying: requestor
- 				notifying: aController
  				logged: logFlag.!

Item was changed:
  ----- Method: Compiler class>>evaluate:logged: (in category 'evaluating logged') -----
  evaluate: textOrString logged: logFlag 
+ 	"See Compiler|evaluate:for:notifying:logged:. If a compilation error occurs, a SyntaxErrorNotification is raised rather than notifying any requestor. 
- 	"See Compiler|evaluate:for:notifying:logged:. If a compilation error occurs, 
- 	a Syntax Error view is created rather than notifying any requestor. 
  	Compilation is carried out with respect to nil, i.e., no object."
  
  	^self evaluate: textOrString for: nil logged: logFlag!

Item was changed:
  ----- Method: Compiler class>>evaluate:notifying: (in category 'evaluating') -----
+ evaluate: textOrString notifying: requestor
+ 	"See Compiler|evaluate:for:notifying:logged:. Compilation is carried out with respect to nil, i.e., no object."
- evaluate: textOrString notifying: aController
- 	"See Compiler|evaluate:for:notifying:logged:. Compilation is carried out 
- 	with respect to nil, i.e., no object."
  
+ 	^self evaluate: textOrString for: nil notifying: requestor!
- 	^self evaluate: textOrString for: nil notifying: aController!

Item was changed:
  ----- Method: Compiler class>>evaluate:notifying:logged: (in category 'evaluating logged') -----
+ evaluate: textOrString notifying: requestor logged: logFlag 
+ 	"See Compiler|evaluate:for:notifying:logged:. Compilation is carried out with respect to nil, i.e., no object."
- evaluate: textOrString notifying: aController logged: logFlag 
- 	"See Compiler|evaluate:for:notifying:logged:. Compilation is carried out 
- 	with respect to nil, i.e., no object."
  
+ 	^self evaluate: textOrString for: nil notifying: requestor logged: logFlag!
- 	^self evaluate: textOrString for: nil notifying: aController logged: logFlag!

Item was changed:
  ----- Method: Compiler class>>format:in:notifying: (in category 'evaluating') -----
+ format: textOrStream in: aClass notifying: requestor
+ 	^self new format: textOrStream in: aClass notifying: requestor!
- format: textOrStream in: aClass notifying: aRequestor
- 	^self new format: textOrStream in: aClass notifying: aRequestor!

Item was changed:
  ----- Method: Compiler class>>format:in:notifying:decorated: (in category 'evaluating') -----
+ format: textOrStream in: aClass notifying: requestor decorated: aBoolean
+ 	^self new format: textOrStream in: aClass notifying: requestor decorated: aBoolean!
- format: textOrStream in: aClass notifying: aRequestor decorated: aBoolean
- 	^self new format: textOrStream in: aClass notifying: aRequestor decorated: aBoolean!

Item was changed:
  ----- Method: Compiler>>compile:ifFail: (in category 'public access') -----
  compile: aCue ifFail: failBlock 
+ 	"Answer a MethodNode.
+ 	If the cue requestor is not nil, use it for interactive error correction, and evaluate failBlock after the compilation has been aborted.
+ 	The MethodNode is the root of a parse tree. It can be told to generate a CompiledMethod to be installed in the method dictionary of the class specified by the context."
- 	"Answer a MethodNode. If the MethodNode can not be created, notify 
- 	the requestor in the contxt. If the requestor is nil, evaluate failBlock 
- 	instead. The MethodNode is the root  of a parse tree. It can be told 
- 	to generate a CompiledMethod to be installed in the method dictionary 
- 	of the class specified by the context."
  	
  	^self
  		compileCue: aCue
  		noPattern: false
+ 		ifFail: failBlock!
- 		ifFail: failBlock !

Item was changed:
  ----- Method: Compiler>>compile:in:environment:notifying:ifFail: (in category 'public access') -----
+ compile: textOrStream in: aClass environment: anEnvironment notifying: requestor ifFail: failBlock 
+ 	"Answer a MethodNode for the argument, textOrStream.
+ 	If requestor is not nil, use it for interactive error correction, and evaluate failBlock after the compilation has been aborted.
+ 	The MethodNode is the root of a parse tree. It can be told to generate a CompiledMethod to be installed in the method dictionary of the argument, aClass."
- compile: textOrStream in: aClass environment: anEnvironment notifying: aRequestor ifFail: failBlock 
- 	"Answer a MethodNode for the argument, textOrStream. If the 
- 	MethodNode can not be created, notify the argument, aRequestor; if 
- 	aRequestor is nil, evaluate failBlock instead. The MethodNode is the root 
- 	of a parse tree. It can be told to generate a CompiledMethod to be 
- 	installed in the method dictionary of the argument, aClass."
  
  	^self
  		compileCue: (CompilationCue
  			source: textOrStream
  			class: aClass
  			environment: anEnvironment
+ 			requestor: requestor)
- 			requestor: aRequestor)
  		noPattern: false
+ 		ifFail: failBlock!
- 		ifFail: failBlock
- !

Item was changed:
  ----- Method: Compiler>>compile:in:notifying:ifFail: (in category 'public access') -----
+ compile: textOrStream in: aClass notifying: requestor ifFail: failBlock 
+ 	"Answer a MethodNode for the argument, textOrStream.
+ 	If requestor is not nil, use it for interactive error correction, and evaluate failBlock after the compilation has been aborted.
+ 	The MethodNode is the root of a parse tree. It can be told to generate a CompiledMethod to be installed in the method dictionary of the argument, aClass."
- compile: textOrStream in: aClass notifying: aRequestor ifFail: failBlock 
- 	"Answer a MethodNode for the argument, textOrStream. If the 
- 	MethodNode can not be created, notify the argument, aRequestor; if 
- 	aRequestor is nil, evaluate failBlock instead. The MethodNode is the root 
- 	of a parse tree. It can be told to generate a CompiledMethod to be 
- 	installed in the method dictionary of the argument, aClass."
  
  	^self
  		compileCue: (CompilationCue
  			source: textOrStream
  			class: aClass
+ 			requestor: requestor)
- 			requestor: aRequestor)
  		noPattern: false
+ 		ifFail: failBlock!
- 		ifFail: failBlock
- !

Item was changed:
  ----- Method: Compiler>>compileCue:noPattern:ifFail: (in category 'private') -----
  compileCue: aCue noPattern: aBoolean ifFail: failBlock 
  	"Answer a MethodNode corresponding to cue source.
+ 	If the cue requestor is not nil, use it for interactive error correction, and evaluate failBlock after the compilation has been aborted.
+ 	The MethodNode is the root of a parse tree. It can be told to generate a CompiledMethod:
- 	If the MethodNode can not be created, notify the cue requestor.
- 	If the cue requestor is nil, evaluate failBlock instead.
- 	The MethodNode is the root  of a parse tree.
- 	It can be told to generate a CompiledMethod
  	- either to be evaluated in cue context if aBoolean is true, with cue receiver as method receiver,
  	- or to be installed in the method dictionary of the target class specified by the cue if aBoolean is false."
+ 
- 	
  	self setCue: aCue.
  	^self translateNoPattern: aBoolean	ifFail: failBlock!

Item was added:
+ ----- Method: Compiler>>compileNoPattern: (in category 'public access') -----
+ compileNoPattern: textOrStream
+ 
+ 	^ self
+ 		compileNoPattern: textOrStream
+ 		in: nil class!

Item was added:
+ ----- Method: Compiler>>compileNoPattern:in: (in category 'public access') -----
+ compileNoPattern: textOrStream in: aClass
+ 
+ 	^ self
+ 		compileNoPattern: textOrStream
+ 		in: aClass
+ 		notifying: nil
+ 		ifFail: [^ nil]!

Item was changed:
  ----- Method: Compiler>>compileNoPattern:in:context:environment:notifying:ifFail: (in category 'public access') -----
+ compileNoPattern: textOrStream in: aClass context: aContext environment: anEnvironment notifying: requestor ifFail: failBlock
- compileNoPattern: textOrStream in: aClass context: aContext environment: anEnvironment notifying: aRequestor ifFail: failBlock
  	"Similar to #compile:in:notifying:ifFail:, but the compiled code is
  	expected to be a do-it expression, with no message pattern,
  	and it will be in an explicit environment."
  
  	^self
  		compileCue: (CompilationCue
  			source: textOrStream
  			context: aContext
  			class: aClass
  			environment: anEnvironment
+ 			requestor: requestor)
- 			requestor: aRequestor)
  		noPattern: true
+ 		ifFail: failBlock!
- 		ifFail: failBlock
- !

Item was changed:
  ----- Method: Compiler>>compileNoPattern:in:context:notifying:ifFail: (in category 'public access') -----
+ compileNoPattern: textOrStream in: aClass context: aContext notifying: requestor ifFail: failBlock
- compileNoPattern: textOrStream in: aClass context: aContext notifying: aRequestor ifFail: failBlock
  	"Similar to #compile:in:notifying:ifFail:, but the compiled code is
  	expected to be a do-it expression, with no message pattern."
  
  	^self
  		compileCue: (CompilationCue
  			source: textOrStream
  			context: aContext
  			class: aClass
+ 			requestor: requestor)
- 			requestor: aRequestor)
  		noPattern: true
+ 		ifFail: failBlock!
- 		ifFail: failBlock
- !

Item was changed:
  ----- Method: Compiler>>compileNoPattern:in:notifying:ifFail: (in category 'public access') -----
+ compileNoPattern: textOrStream in: aClass notifying: requestor ifFail: failBlock
- compileNoPattern: textOrStream in: aClass notifying: aRequestor ifFail: failBlock
  	"Similar to #compile:in:notifying:ifFail:, but the compiled code is
  	expected to be a do-it expression, with no message pattern."
  
  	^self
  		compileCue: (CompilationCue
  			source: textOrStream
  			class: aClass
+ 			requestor: requestor)
- 			requestor: aRequestor)
  		noPattern: true
+ 		ifFail: failBlock!
- 		ifFail: failBlock
- !

Item was changed:
  ----- Method: Compiler>>compiledMethodFor:in:to:notifying:ifFail: (in category 'public access') -----
+ compiledMethodFor: textOrStream in: aContext to: receiver notifying: requestor ifFail: failBlock
+ 	"Compiles the sourceStream into a parse tree, then generates code into a method, and answers it.
+ 	If receiver is not nil, then the text can refer to instance variables of that receiver (the Inspector uses this).
+ 	If aContext is not nil, the text can refer to temporaries in that context (the Debugger uses this).
+ 	If requestor is not nil, use it for interactive error correction, and evaluate failBlock after the compilation has been aborted."
- compiledMethodFor: textOrStream in: aContext to: receiver notifying: aRequestor ifFail: failBlock
- 	"Compiles the sourceStream into a parse tree, then generates code
- 	 into a method, and answers it.  If receiver is not nil, then the text can
- 	 refer to instance variables of that receiver (the Inspector uses this).
- 	 If aContext is not nil, the text can refer to temporaries in that context
- 	 (the Debugger uses this). If aRequestor is not nil, then it will receive a 
- 	 notify:at: message before the attempt to evaluate is aborted."
  
  	| methodNode method |
  	methodNode := self
  		compileNoPattern: textOrStream
  		in: (self classForReceiver: receiver context: aContext)
  		context: aContext
+ 		notifying: requestor
- 		notifying: aRequestor
  		ifFail: [^failBlock value].
  	method := self interactive
  		ifTrue: [ methodNode generateWithTempNames ] 
  		ifFalse: [ methodNode generate ].
  	^method!

Item was changed:
  ----- Method: Compiler>>compiledMethodFor:in:to:notifying:ifFail:logged: (in category 'public access logging') -----
+ compiledMethodFor: textOrStream in: aContext to: receiver notifying: requestor ifFail: failBlock logged: logFlag
+ 	"Compiles the sourceStream into a parse tree, then generates code into a method, and answers it.
+ 	If receiver is not nil, then the text can refer to instance variables of that receiver (the Inspector uses this).
+ 	If aContext is not nil, the text can refer to temporaries in that context (the Debugger uses this).
+ 	If requestor is not nil, use it for interactive compilation, and evaluate failBlock after the compilation has been aborted."
- compiledMethodFor: textOrStream in: aContext to: receiver notifying: aRequestor ifFail: failBlock logged: logFlag
- 	"Compiles the sourceStream into a parse tree, then generates code
- 	 into a method, and answers it.  If receiver is not nil, then the text can
- 	 refer to instance variables of that receiver (the Inspector uses this).
- 	 If aContext is not nil, the text can refer to temporaries in that context
- 	 (the Debugger uses this). If aRequestor is not nil, then it will receive a 
- 	 notify:at: message before the attempt to evaluate is aborted."
  
  	| method |
  	method := self
  		compiledMethodFor: textOrStream
  		in: aContext
  		to: receiver
+ 		notifying: requestor
- 		notifying: aRequestor
  		ifFail: [^failBlock value].
  	logFlag ifTrue:
  		[SystemChangeNotifier uniqueInstance evaluated: cue stringToLog context: aContext].
  	^method!

Item was changed:
  ----- Method: Compiler>>evaluate: (in category 'public access') -----
  evaluate: textOrString 
+ 	"See evaluate:for:notifying:logged:. If a compilation error occurs, a SyntaxErrorNotification is signaled rather than notifying any requestor.
+ 	Compilation is carried out with respect to nil, i.e., no object, and the invocation is not logged."
- 	"See evaluate:for:notifying:logged:. If a compilation error occurs, 
- 	a Syntax Error view is created rather than notifying any requestor. 
- 	Compilation is carried out with respect to nil, i.e., no object, and the 
- 	invocation is not logged."
  
  	^self evaluate: textOrString for: nil!

Item was changed:
  ----- Method: Compiler>>evaluate:for: (in category 'public access') -----
  evaluate: textOrString for: anObject
+ 	"See evaluate:for:notifying:logged:. If a compilation error occurs, a SyntaxErrorNotification is signaled rather than notifying any requestor."
- 	"See evaluate:for:notifying:logged:. If a compilation error occurs, 
- 	a Syntax Error view is created rather than notifying any requestor."
  
  	^self evaluate: textOrString for: anObject notifying: nil!

Item was changed:
  ----- Method: Compiler>>evaluate:for:logged: (in category 'public access logging') -----
  evaluate: textOrString for: anObject logged: logFlag 
+ 	"See evaluate:for:notifying:logged:. If a compilation error occurs, a SyntaxError is signaled rather than notifying any requestor."
- 	"See evaluate:for:notifying:logged:. If a compilation error occurs, 
- 	a Syntax Error view is created rather than notifying any requestor."
  
  	^self evaluate: textOrString for: anObject notifying: nil logged: logFlag!

Item was changed:
  ----- Method: Compiler>>evaluate:for:notifying: (in category 'public access') -----
+ evaluate: textOrString for: anObject notifying: requestor
+ 	"Compile and execute the argument, textOrString with respect to the class of anObject. If a compilation error occurs, use requestor for interactive compilation."
- evaluate: textOrString for: anObject notifying: aController
- 	"Compile and execute the argument, textOrString with respect to the class 
- 	of anObject. If a compilation error occurs, notify aController."
  
  	^ self
  		evaluate: textOrString
  		in: nil
  		to: anObject
+ 		notifying: requestor
- 		notifying: aController
  		ifFail: [^nil]!

Item was changed:
  ----- Method: Compiler>>evaluate:for:notifying:logged: (in category 'public access logging') -----
+ evaluate: textOrString for: anObject notifying: requestor logged: logFlag
+ 	"Compile and execute the argument, textOrString with respect to the class of anObject.
+ 	If a compilation error occurs, use requestor for interactive compilation.
+ 	If both compilation and execution are successful then, if logFlag is true, log (write) the text onto a system changes file so that it can be replayed if necessary."
- evaluate: textOrString for: anObject notifying: aController logged: logFlag
- 	"Compile and execute the argument, textOrString with respect to the class 
- 	of anObject. If a compilation error occurs, notify aController. If both 
- 	compilation and execution are successful then, if logFlag is true, log 
- 	(write) the text onto a system changes file so that it can be replayed if 
- 	necessary."
  
  	^ self
  		evaluate: textOrString
  		in: nil
  		to: anObject
+ 		notifying: requestor
- 		notifying: aController
  		ifFail: [^nil]
  		logged: logFlag.!

Item was changed:
  ----- Method: Compiler>>evaluate:in:environment:notifying:ifFail:logged: (in category 'public access logging') -----
+ evaluate: textOrStream in: aContext environment: anEnvironment notifying: requestor ifFail: failBlock logged: logFlag
+ 	"Compiles the sourceStream into a parse tree, then generates code into a method.
+ 	If aContext is not nil, the text can refer to temporaries in that context (the Debugger uses this).
+ 	If requestor is not nil, use it for interactive compilation, and evaluate failBlock after the compilation has been aborted.
+ 	Finally, the compiled method is invoked from here via withArgs:executeMethod:, hence the system no longer creates Doit method litter on errors."
- evaluate: textOrStream in: aContext environment: anEnvironment notifying: aRequestor ifFail: failBlock logged: logFlag
- 	"Compiles the sourceStream into a parse tree, then generates code into
- 	 a method. If aContext is not nil, the text can refer to temporaries in that
- 	 context (the Debugger uses this). If aRequestor is not nil, then it will receive
- 	 a notify:at: message before the attempt to evaluate is aborted. Finally, the 
- 	 compiled method is invoked from here via withArgs:executeMethod:, hence
- 	 the system no longer creates Doit method litter on errors."
  	^self
  		evaluateCue: (CompilationCue
  			source: textOrStream
  			context: aContext
  			receiver: nil
  			class: UndefinedObject
  			environment: anEnvironment
+ 			requestor: requestor)
- 			requestor: aRequestor)
  		ifFail: failBlock
  		logged: logFlag!

Item was changed:
  ----- Method: Compiler>>evaluate:in:notifying:logged: (in category 'public access logging') -----
+ evaluate: textOrString in: anEnvironment notifying: requestor logged: logFlag 
- evaluate: textOrString in: anEnvironment notifying: aController logged: logFlag 
  	"Compile and execute the argument, textOrString in anEnvironment.
+ 	If a compilation error occurs, use requestor for interactive compilation.
+ 	If both compilation and execution are successful then, if logFlag is true, log (write) the text onto a system changes file so that it can be replayed if necessary."
- 	If a compilation error occurs, notify aController. If both 
- 	compilation and execution are successful then, if logFlag is true, log 
- 	(write) the text onto a system changes file so that it can be replayed if 
- 	necessary."
  
  	^self
  		evaluate: textOrString
  		in: nil
  		environment: anEnvironment
+ 		notifying: requestor
- 		notifying: aController
  		ifFail: [^nil]
  		logged: logFlag!

Item was changed:
  ----- Method: Compiler>>evaluate:in:to:environment:notifying:ifFail:logged: (in category 'public access logging') -----
+ evaluate: textOrStream in: aContext to: receiver environment: anEnvironment notifying: requestor ifFail: failBlock logged: logFlag
- evaluate: textOrStream in: aContext to: receiver environment: anEnvironment notifying: aRequestor ifFail: failBlock logged: logFlag
  	"Same as #evaluate:in:to:notifying:ifFail:logged: but with an explicit environment"
  	^self
  		evaluateCue: (CompilationCue
  			source: textOrStream
  			context: aContext
  			receiver: receiver
  			class: (self classForReceiver: receiver context: aContext)
  			environment: anEnvironment
+ 			requestor: requestor)
- 			requestor: aRequestor)
  		ifFail: failBlock
  		logged: logFlag!

Item was changed:
  ----- Method: Compiler>>evaluate:in:to:notifying:ifFail: (in category 'public access') -----
+ evaluate: textOrStream in: aContext to: receiver notifying: requestor ifFail: failBlock
+ 	"Compiles the sourceStream into a parse tree, then generates code into a method.
+ 	If aContext is not nil, the text can refer to temporaries in that context (the Debugger uses this).
+ 	If requestor is not nil, use it for interactive error correction, and evaluate failBlock if the compilation fails.
+ 	Finally, the compiled method is invoked from here via withArgs:executeMethod:, hence the system no longer creates Doit method litter on errors."
+ 
- evaluate: textOrStream in: aContext to: receiver notifying: aRequestor ifFail: failBlock
- 	"Compiles the sourceStream into a parse tree, then generates code into
- 	 a method. If aContext is not nil, the text can refer to temporaries in that
- 	 context (the Debugger uses this). If aRequestor is not nil, then it will receive
- 	 a notify:at: message before the attempt to evaluate is aborted. Finally, the 
- 	 compiled method is invoked from here via withArgs:executeMethod:, hence
- 	 the system no longer creates Doit method litter on errors."
- 	
  	| theClass |
  	theClass := self classForReceiver: receiver context: aContext.
  	^self
  		evaluateCue: (CompilationCue
  			source: textOrStream
  			context: aContext
  			receiver: receiver
  			class: theClass
  			environment: theClass environment
+ 			requestor: requestor)
- 			requestor: aRequestor)
  		ifFail: failBlock!

Item was changed:
  ----- Method: Compiler>>evaluate:in:to:notifying:ifFail:logged: (in category 'public access logging') -----
+ evaluate: textOrStream in: aContext to: receiver notifying: requestor ifFail: failBlock logged: logFlag
+ 	"Compiles the sourceStream into a parse tree, then generates code into a method.
+ 	If aContext is not nil, the text can refer to temporaries in that context (the Debugger uses this).
+ 	If requestor is not nil, use it for interactive compilation, and evaluate failBlock if the compilation fails.
+ 	Finally, the compiled method is invoked from here via withArgs:executeMethod:, hence the system no longer creates Doit method litter on errors."
+ 
- evaluate: textOrStream in: aContext to: receiver notifying: aRequestor ifFail: failBlock logged: logFlag
- 	"Compiles the sourceStream into a parse tree, then generates code into
- 	 a method. If aContext is not nil, the text can refer to temporaries in that
- 	 context (the Debugger uses this). If aRequestor is not nil, then it will receive
- 	 a notify:at: message before the attempt to evaluate is aborted. Finally, the 
- 	 compiled method is invoked from here via withArgs:executeMethod:, hence
- 	 the system no longer creates Doit method litter on errors."
  	| theClass |
  	theClass := self classForReceiver: receiver context: aContext.
  	^self
  		evaluateCue: (CompilationCue
  			source: textOrStream
  			context: aContext
  			receiver: receiver
  			class: theClass
  			environment: theClass environment
+ 			requestor: requestor)
- 			requestor: aRequestor)
  		ifFail: failBlock
  		logged: logFlag!

Item was changed:
  ----- Method: Compiler>>evaluate:logged: (in category 'public access logging') -----
  evaluate: textOrString logged: logFlag 
+ 	"See evaluate:for:notifying:logged:. If a compilation error occurs, a SyntaxErrorNotification is signaled rather than notifying any requestor.
- 	"See evaluate:for:notifying:logged:. If a compilation error occurs, 
- 	a Syntax Error view is created rather than notifying any requestor. 
  	Compilation is carried out with respect to nil, i.e., no object."
  
  	^self evaluate: textOrString for: nil logged: logFlag!

Item was changed:
  ----- Method: Compiler>>evaluate:notifying: (in category 'public access') -----
+ evaluate: textOrString notifying: requestor
+ 	"See evaluate:for:notifying:. Compilation is carried out with respect to nil, i.e., no object."
- evaluate: textOrString notifying: aController
- 	"See evaluate:for:notifying:. Compilation is carried out 
- 	with respect to nil, i.e., no object."
  
+ 	^self evaluate: textOrString for: nil notifying: requestor!
- 	^self evaluate: textOrString for: nil notifying: aController!

Item was changed:
  ----- Method: Compiler>>evaluate:notifying:logged: (in category 'public access logging') -----
+ evaluate: textOrString notifying: requestor logged: logFlag 
+ 	"See evaluate:for:notifying:logged:. Compilation is carried out with respect to nil, i.e., no object."
- evaluate: textOrString notifying: aController logged: logFlag 
- 	"See evaluate:for:notifying:logged:. Compilation is carried out 
- 	with respect to nil, i.e., no object."
  
+ 	^self evaluate: textOrString for: nil notifying: requestor logged: logFlag!
- 	^self evaluate: textOrString for: nil notifying: aController logged: logFlag!

Item was changed:
  ----- Method: Compiler>>format:in:notifying: (in category 'public access') -----
+ format: textOrStream in: aClass notifying: requestor
+ 	"Compile a parse tree from the argument, textOrStream. Answer a string containing the original code, formatted nicely. If aBoolean is true, then decorate the resulting text with color and hypertext actions."
- format: textOrStream in: aClass notifying: aRequestor
- 	"Compile a parse tree from the argument, textOrStream. Answer a string containing the original code, formatted nicely.  If aBoolean is true, then decorate the resulting text with color and hypertext actions"
  
  	| aNode |
  	self from: textOrStream
  		class: aClass
+ 		notifying: requestor.
- 		notifying: aRequestor.
  	aNode := self formatNoPattern: false ifFail: [^ nil].
- 
- 	"aSymbol == #colorPrint ifTrue:
- 		[^aNode asColorizedSmalltalk80Text]." "deprecating #colorPrint in favor of Shout --Ron Spengler"
- 
  	^aNode decompileString!

Item was changed:
  ----- Method: Compiler>>format:in:notifying:decorated: (in category 'public access') -----
+ format: textOrStream in: aClass notifying: requestor decorated: aBoolean
+ 	"Compile a parse tree from the argument, textOrStream. Answer a string containing the original code, formatted nicely. If aBoolean is true, then decorate the resulting text with color and hypertext actions."
+ 
- format: textOrStream in: aClass notifying: aRequestor decorated: aBoolean
- 	"Compile a parse tree from the argument, textOrStream. Answer a string containing the original code, formatted nicely.  If aBoolean is true, then decorate the resulting text with color and hypertext actions"
  	| aNode |
  	self from: textOrStream
  		class: aClass
+ 		notifying: requestor.
- 		notifying: aRequestor.
  	aNode := self formatNoPattern: false ifFail: [^ nil].
  	^ aBoolean
  		ifTrue: [aNode decompileText]
  		ifFalse: [aNode decompileString]!

Item was changed:
  ----- Method: Compiler>>parse:in:notifying: (in category 'public access') -----
  parse: textOrStream in: aClass notifying: req
+ 	"Compile the argument, textOrStream, with respect to the class, aClass, and answer the MethodNode that is the root of the resulting parse tree. If an error occurs, use requestor for interactive error handling."
- 	"Compile the argument, textOrStream, with respect to the class, aClass, and
- 	 answer the MethodNode that is the root of the resulting parse tree.  Notify the
- 	 argument, req, if an error occurs. The failBlock is defaulted to an empty block."
  
  	self from: textOrStream class: aClass notifying: req.
  	^self parser
  		parseCue: cue
  		noPattern: false
  		ifFail: []!

Item was changed:
  ----- Method: Parser>>notify:at: (in category 'error handling') -----
  notify: string at: location 
  	| messageText |
  	messageText := '"' , string , ' ->"'.
  	cue requestor isNil
  		ifTrue: [
  			| notification |
  			(encoder == self or: [encoder isNil])
+ 				ifTrue: [^ self interactive
+ 					ifTrue: [self fail]
+ 					ifFalse: [self error: 'failure setting up syntax error']].
- 				ifTrue: [^ self fail "failure setting up syntax error"].
  			(notification := SyntaxErrorNotification
  				cue: (cue copy
  					source: (source contents asText
  						copyReplaceFrom: location
  						to: location - 1
  						with: messageText);
  					yourself)
  				doitFlag: doitFlag
  				errorMessage: string
  				location: location) signal.
  			notification tryNewSourceIfAvailable]
  		ifFalse: [cue requestor
  			notify: messageText
  			at: location
  			in: source].
  	^ self fail!



More information about the Squeak-dev mailing list