[squeak-dev] The Trunk: Compiler-nice.199.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Mar 30 19:57:01 UTC 2011
Nicolas Cellier uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-nice.199.mcz
==================== Summary ====================
Name: Compiler-nice.199
Author: nice
Time: 30 March 2011, 9:56:40.201 pm
UUID: 40f46685-08e8-4661-95bd-8be4327c963b
Ancestors: Compiler-IgorStasenko.198
Use #newCompiler #newParser
Move some #evaluate: methods to instance side to enable (self class newCompiler evaluate: 'nil') usage
=============== Diff against Compiler-IgorStasenko.198 ===============
Item was changed:
----- Method: Compiler class>>new (in category 'accessing') -----
new
+ ^ super new parser: self newParser!
- ^ super new parser: self parserClass new!
Item was added:
+ ----- Method: Compiler>>evaluate: (in category 'public access') -----
+ evaluate: textOrString
+ "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 logged: false!
Item was added:
+ ----- Method: Compiler>>evaluate:for:logged: (in category 'public access') -----
+ evaluate: textOrString for: anObject logged: logFlag
+ "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 added:
+ ----- Method: Compiler>>evaluate:for:notifying:logged: (in category 'public access') -----
+ 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: aController
+ ifFail: [^nil]
+ logged: logFlag.!
Item was changed:
----- Method: Compiler>>evaluate:in:to: (in category 'public access') -----
evaluate: aString in: aContext to: aReceiver
"evaluate aString in the given context, and return the result. 2/2/96 sw"
+ ^self
+ evaluate: aString
+ in: aContext
+ to: aReceiver
+ notifying: nil
+ ifFail: [^ #failedDoit]!
- | result |
- result := self
- evaluate: aString
- in: aContext
- to: aReceiver
- notifying: nil
- ifFail: [^ #failedDoit].
- ^ result!
Item was added:
+ ----- Method: Compiler>>evaluate:logged: (in category 'public access') -----
+ evaluate: textOrString logged: logFlag
+ "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 added:
+ ----- Method: Compiler>>evaluate:notifying:logged: (in category 'public access') -----
+ 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: aController logged: logFlag!
Item was changed:
----- Method: Compiler>>parser (in category 'public access') -----
parser
+ parser ifNil: [parser := (class ifNil: [self class]) newParser].
- parser ifNil: [parser := self parserClass new].
^parser!
Item was removed:
- ----- Method: Compiler>>parserClass (in category 'public access') -----
- parserClass
-
- ^parser ifNil: [self class parserClass] ifNotNil: [parser class]!
Item was changed:
----- Method: MethodNode>>blockExtentsToTempsMap (in category 'debugger support') -----
blockExtentsToTempsMap
"Answer a Dictionary of blockExtent to temp locations for the current method.
This is used by the debugger to locate temp vars in contexts. A temp map
entry is a pair of the temp's name and its index, where an index is either an
integer for a normal temp or a pair of the index of the indirect temp vector
containing the temp and the index of the temp in its indirect temp vector."
^encoder blockExtentsToTempsMap ifNil:
[| methNode |
+ methNode := encoder classEncoding newParser
- methNode := encoder classEncoding parserClass new
encoderClass: encoder class;
parse: (sourceText ifNil: [self decompileString])
class: self methodClass.
"As a side effect generate: creates data needed for the map."
methNode generate.
methNode encoder blockExtentsToTempsMap]!
Item was changed:
----- Method: MethodNode>>rawSourceRangesAndMethodDo: (in category 'source mapping') -----
rawSourceRangesAndMethodDo: aBinaryBlock
"Evaluate aBinaryBlock with the rawSourceRanges and method generated from the receiver."
| methNode method |
+ methNode := encoder classEncoding newParser
- methNode := encoder classEncoding parserClass new
encoderClass: encoder class;
parse: (sourceText "If no source, use decompile string as source to map from"
ifNil: [self decompileString]
ifNotNil: [sourceText])
class: self methodClass.
method := methNode generate. "set bytecodes to map to"
^aBinaryBlock
value: methNode encoder rawSourceRanges
value: method!
More information about the Squeak-dev
mailing list
|