Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

21385-The-dialog-for-Unknown-variable-should-allow-to-leave-the-variable-undefined #926

Merged
merged 1 commit into from
Feb 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/OpalCompiler-Core/OCUndeclaredVariableWarning.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ OCUndeclaredVariableWarning >> declareTempAndPaste: name [
(OCSourceCodeChanged new newSourceCode: self requestor text) signal
]

{ #category : #correcting }
OCUndeclaredVariableWarning >> declareUndefined [

Undeclared add: (UndeclaredVariable named: node name asSymbol).
^OCUndeclaredVariable new name: node name asSymbol
]

{ #category : #correcting }
OCUndeclaredVariableWarning >> defaultAction [
| varName className selector |
Expand Down Expand Up @@ -168,6 +175,9 @@ OCUndeclaredVariableWarning >> openMenuIn: aBlock [
labels add: 'Declare new instance variable'.
actions add: [ self declareInstVar: name ] ]
ifFalse: [
labels add: 'Leave variable undeclared'.
actions add: [ self declareUndefined ].
lines add: labels size.
labels add: 'Define new class'.
actions
add: [
Expand Down
2 changes: 1 addition & 1 deletion src/Reflectivity/LiteralVariable.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ LiteralVariable >> link: aMetaLink [
(aMetaLink checkForCompatibilityWith: self) ifFalse: [ self error: 'link requests reification that can not be provided by this node' ].

methods := self usingMethods.
(self propertyAt: #links ifAbsentPut: [ IdentitySet new ]) add: aMetaLink.
(self propertyAt: #links ifAbsentPut: [ OrderedCollection new ]) add: aMetaLink.
aMetaLink installOnVariable: self.
methods
do: [ :method |
Expand Down
1 change: 1 addition & 0 deletions src/Reflectivity/MetaLink.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ MetaLink class >> defaultOptions [
- optionOneShot "remove link after first activation"
- optionMetalevel "force level: 0 for the link"
- optionDisabledLink "links are active by default"
+ optionWeakAfter "do not use #ensure: for #after "
)
]

Expand Down
3 changes: 2 additions & 1 deletion src/Reflectivity/RBProgramNode.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ RBProgramNode >> afterLinks [
{ #category : #'*Reflectivity' }
RBProgramNode >> allAfterAreWeak [
self hasMetalink ifFalse: [^false].
self isMessage ifFalse: [^false]. "only sends are weak"
^self afterLinks allSatisfy: [ :link | link hasOption: #optionWeakAfter ].
]

Expand Down Expand Up @@ -93,7 +94,7 @@ RBProgramNode >> invalidate [
{ #category : #'*Reflectivity' }
RBProgramNode >> link: aMetaLink [
(aMetaLink checkForCompatibilityWith: self) ifFalse: [ self error: 'link requests reification that can not be provided by this node' ].
(self propertyAt: #links ifAbsentPut: [ IdentitySet new ]) add: aMetaLink.
(self propertyAt: #links ifAbsentPut: [ OrderedCollection new ]) add: aMetaLink.
aMetaLink installOn: self.
self clearReflectivityAnnotations.
self methodNode method installLink: aMetaLink.
Expand Down
2 changes: 1 addition & 1 deletion src/Reflectivity/Slot.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Slot >> link: aMetaLink [
(aMetaLink checkForCompatibilityWith: self) ifFalse: [ self error: 'link requests reification that can not be provided by this node' ].

methods := self usingMethods.
(self propertyAt: #links ifAbsentPut: [ IdentitySet new ]) add: aMetaLink.
(self propertyAt: #links ifAbsentPut: [ OrderedCollection new ]) add: aMetaLink.
aMetaLink installOnVariable: self.
methods
do: [ :method |
Expand Down
2 changes: 1 addition & 1 deletion src/Reflectivity/TemporaryVariable.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ TemporaryVariable >> insteadLinks [
TemporaryVariable >> link: aMetaLink [
(aMetaLink checkForCompatibilityWith: self) ifFalse: [ self error: 'link requests reification that can not be provided by this node' ].

(self propertyAt: #links ifAbsentPut: [ IdentitySet new ]) add: aMetaLink.
(self propertyAt: #links ifAbsentPut: [ OrderedCollection new ]) add: aMetaLink.
aMetaLink installOnVariable: self.
method
createTwin;
Expand Down