[squeak-dev] The Inbox: Compiler-nice.187.mcz

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Fri Feb 4 21:22:34 UTC 2011


2011/2/4  <commits at source.squeak.org>:
> A new version of Compiler was added to project The Inbox:
> http://source.squeak.org/inbox/Compiler-nice.187.mcz
>
> ==================== Summary ====================
>
> Name: Compiler-nice.187
> Author: nice
> Time: 4 February 2011, 10:17:14.337 pm
> UUID: 71dd94ed-3fc7-49e0-b180-fb04be82bc29
> Ancestors: Compiler-nice.184
>
> In case nil is the doItReceiver of an interactive evaluation, avoid proposing a menu that would add an inst var to UndefinedObject.
>
> =============== Diff against Compiler-nice.184 ===============
>
> Item was added:
> + ----- Method: Parser>>canDeclareInstanceVariable (in category 'error correction') -----
> + canDeclareInstanceVariable
> +       ^encoder classEncoding ~~ UndefinedObject!
>
> Item was changed:
>  ----- Method: UndeclaredVariable>>openMenuIn: (in category 'as yet unclassified') -----
>  openMenuIn: aBlock
>        | alternatives labels actions lines caption choice |
>        alternatives := parser possibleVariablesFor: name.
>        labels := OrderedCollection new.
>        actions := OrderedCollection new.
>        lines := OrderedCollection new.
>        name first isLowercase
>                ifTrue:
>                        [labels add: 'declare method temp'.
>                        actions add: [parser declareTemp: name at: #method].
>                        labels add: 'declare block-local temp'.
>                        actions add: [parser declareTemp: name at: #block].
> +                       parser canDeclareClassVariable
> +                               ifTrue:
> +                                       [labels add: 'declare instance'.
> +                                       actions add: [parser declareInstVar: name]]]

Oops, it passed my tests, but it's wrong, my intention was
canDeclareInstanceVariable.
These diffs are great !

Nicolas


> -                       labels add: 'declare instance'.
> -                       actions add: [parser declareInstVar: name]]
>                ifFalse:
>                        [labels add: 'define new class'.
>                        actions add: [parser defineClass: name].
>                        labels add: 'declare global'.
>                        actions add: [parser declareGlobal: name].
>                        parser canDeclareClassVariable
>                                ifTrue:
>                                        [labels add: 'declare class variable'.
>                                        actions add: [parser declareClassVar: name]]].
>        lines add: labels size.
>        alternatives do:
>                [:each |
>                labels add: each.
>                actions add: [parser substituteVariable: each atInterval: interval]].
>        lines add: labels size.
>        labels add: 'cancel'.
>        caption := 'Unknown variable: ' , name , ' please correct, or cancel:'.
>        choice := aBlock value: labels value: lines value: caption.
>        self resume: (actions at: choice ifAbsent: [nil])!
>
>
>



More information about the Squeak-dev mailing list