Skip to content

Commit

Permalink
Renaming WThis -> WSelf and friends
Browse files Browse the repository at this point in the history
  • Loading branch information
flbulgarelli committed Nov 15, 2015
1 parent db9e1b4 commit c9e61cd
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import org.uqbar.project.wollok.wollokDsl.WObjectLiteral
import org.uqbar.project.wollok.wollokDsl.WReferenciable
import org.uqbar.project.wollok.wollokDsl.WStringLiteral
import org.uqbar.project.wollok.wollokDsl.WSuperInvocation
import org.uqbar.project.wollok.wollokDsl.WThis
import org.uqbar.project.wollok.wollokDsl.WSelf
import org.uqbar.project.wollok.wollokDsl.WVariableDeclaration
import org.uqbar.project.wollok.wollokDsl.WVariableReference
import org.uqbar.project.wollok.wollokDsl.WollokDslPackage
Expand Down Expand Up @@ -205,7 +205,7 @@ from {
}

rule WThisType
G |- WThis thiz : WollokType t
G |- WSelf thiz : WollokType t
from {
val containingMethod = thiz.method
if (containingMethod == null) { // codigo suelto
Expand Down Expand Up @@ -324,7 +324,7 @@ from {
rule RefineMethodReturnType
G |- WMemberFeatureCall call << WollokType newType
from {
if (call.memberCallTarget instanceof WThis) {
if (call.memberCallTarget instanceof WSelf) {
G |- call.memberCallTarget : var WollokType thisType
if (thisType instanceof ClassBasedWollokType) {
G |- call ~> var MessageType typeOfMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import org.uqbar.project.wollok.wollokDsl.WNumberLiteral
import org.uqbar.project.wollok.wollokDsl.WParameter
import org.uqbar.project.wollok.wollokDsl.WProgram
import org.uqbar.project.wollok.wollokDsl.WStringLiteral
import org.uqbar.project.wollok.wollokDsl.WThis
import org.uqbar.project.wollok.wollokDsl.WSelf
import org.uqbar.project.wollok.wollokDsl.WVariableDeclaration
import org.uqbar.project.wollok.wollokDsl.WVariableReference

Expand Down Expand Up @@ -174,7 +174,7 @@ class BoundsBasedTypeSystem implements TypeSystem {
def dispatch void bind(WMemberFeatureCall call) {
call.inferredNode
// solo se vincula con un método de this
if (call.memberCallTarget instanceof WThis) {
if (call.memberCallTarget instanceof WSelf) {
val referencedMethod = call.method.declaringContext.lookupMethod(call.feature)
call <=> referencedMethod
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import org.uqbar.project.wollok.wollokDsl.WParameter
import org.uqbar.project.wollok.wollokDsl.WProgram
import org.uqbar.project.wollok.wollokDsl.WStringLiteral
import org.uqbar.project.wollok.wollokDsl.WTest
import org.uqbar.project.wollok.wollokDsl.WThis
import org.uqbar.project.wollok.wollokDsl.WSelf
import org.uqbar.project.wollok.wollokDsl.WVariable
import org.uqbar.project.wollok.wollokDsl.WVariableDeclaration
import org.uqbar.project.wollok.wollokDsl.WVariableReference
Expand Down Expand Up @@ -87,7 +87,7 @@ class SubstitutionBasedTypeSystem implements TypeSystem {
def dispatch void doAnalyse(WVariable v) { /* does nothing */ }

def dispatch void doAnalyse(WMemberFeatureCall it) {
if (memberCallTarget instanceof WThis)
if (memberCallTarget instanceof WSelf)
addCheck(it, SAME_AS, method.declaringContext.lookupMethod(feature))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
import org.uqbar.project.wollok.wollokDsl.WParameter;
import org.uqbar.project.wollok.wollokDsl.WProgram;
import org.uqbar.project.wollok.wollokDsl.WReferenciable;
import org.uqbar.project.wollok.wollokDsl.WSelf;
import org.uqbar.project.wollok.wollokDsl.WStringLiteral;
import org.uqbar.project.wollok.wollokDsl.WSuperInvocation;
import org.uqbar.project.wollok.wollokDsl.WThis;
import org.uqbar.project.wollok.wollokDsl.WVariable;
import org.uqbar.project.wollok.wollokDsl.WVariableDeclaration;
import org.uqbar.project.wollok.wollokDsl.WVariableReference;
Expand Down Expand Up @@ -1064,7 +1064,7 @@ protected Result<WollokType> applyRuleWConstructorCall(final RuleEnvironment G,
return new Result<WollokType>(t);
}

protected Result<WollokType> typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final WThis thiz) throws RuleFailedException {
protected Result<WollokType> typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final WSelf thiz) throws RuleFailedException {
try {
final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
final Result<WollokType> _result_ = applyRuleWThisType(G, _subtrace_, thiz);
Expand All @@ -1083,7 +1083,7 @@ public Object get() {
}
}

protected Result<WollokType> applyRuleWThisType(final RuleEnvironment G, final RuleApplicationTrace _trace_, final WThis thiz) throws RuleFailedException {
protected Result<WollokType> applyRuleWThisType(final RuleEnvironment G, final RuleApplicationTrace _trace_, final WSelf thiz) throws RuleFailedException {
WollokType t = null; // output parameter
final WMethodDeclaration containingMethod = WollokModelExtensions.method(thiz);
boolean _equals = Objects.equal(containingMethod, null);
Expand Down Expand Up @@ -1402,7 +1402,7 @@ public Object get() {

protected Result<Boolean> applyRuleRefineMethodReturnType(final RuleEnvironment G, final RuleApplicationTrace _trace_, final WMemberFeatureCall call, final WollokType newType) throws RuleFailedException {
WExpression _memberCallTarget = call.getMemberCallTarget();
if ((_memberCallTarget instanceof WThis)) {
if ((_memberCallTarget instanceof WSelf)) {
/* G |- call.memberCallTarget : var WollokType thisType */
WExpression _memberCallTarget_1 = call.getMemberCallTarget();
WollokType thisType = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
import org.uqbar.project.wollok.wollokDsl.WParameter;
import org.uqbar.project.wollok.wollokDsl.WProgram;
import org.uqbar.project.wollok.wollokDsl.WReferenciable;
import org.uqbar.project.wollok.wollokDsl.WSelf;
import org.uqbar.project.wollok.wollokDsl.WStringLiteral;
import org.uqbar.project.wollok.wollokDsl.WThis;
import org.uqbar.project.wollok.wollokDsl.WVariableDeclaration;
import org.uqbar.project.wollok.wollokDsl.WVariableReference;

Expand Down Expand Up @@ -300,7 +300,7 @@ protected void _bind(final WBooleanLiteral l) {
protected void _bind(final WMemberFeatureCall call) {
this.inferredNode(call);
WExpression _memberCallTarget = call.getMemberCallTarget();
if ((_memberCallTarget instanceof WThis)) {
if ((_memberCallTarget instanceof WSelf)) {
WMethodDeclaration _method = WollokModelExtensions.method(call);
WMethodContainer _declaringContext = WollokModelExtensions.declaringContext(_method);
String _feature = call.getFeature();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
import org.uqbar.project.wollok.wollokDsl.WParameter;
import org.uqbar.project.wollok.wollokDsl.WProgram;
import org.uqbar.project.wollok.wollokDsl.WReferenciable;
import org.uqbar.project.wollok.wollokDsl.WSelf;
import org.uqbar.project.wollok.wollokDsl.WStringLiteral;
import org.uqbar.project.wollok.wollokDsl.WTest;
import org.uqbar.project.wollok.wollokDsl.WThis;
import org.uqbar.project.wollok.wollokDsl.WVariable;
import org.uqbar.project.wollok.wollokDsl.WVariableDeclaration;
import org.uqbar.project.wollok.wollokDsl.WVariableReference;
Expand Down Expand Up @@ -157,7 +157,7 @@ protected void _doAnalyse(final WVariable v) {

protected void _doAnalyse(final WMemberFeatureCall it) {
WExpression _memberCallTarget = it.getMemberCallTarget();
if ((_memberCallTarget instanceof WThis)) {
if ((_memberCallTarget instanceof WSelf)) {
WMethodDeclaration _method = WollokModelExtensions.method(it);
WMethodContainer _declaringContext = WollokModelExtensions.declaringContext(_method);
String _feature = it.getFeature();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import org.uqbar.project.wollok.wollokDsl.WNumberLiteral
import org.uqbar.project.wollok.wollokDsl.WObjectLiteral
import org.uqbar.project.wollok.wollokDsl.WReferenciable
import org.uqbar.project.wollok.wollokDsl.WStringLiteral
import org.uqbar.project.wollok.wollokDsl.WThis
import org.uqbar.project.wollok.wollokDsl.WSelf
import org.uqbar.project.wollok.wollokDsl.WVariableReference

import static extension org.uqbar.project.wollok.model.WMethodContainerExtensions.*
Expand Down Expand Up @@ -60,7 +60,7 @@ class WollokDslProposalProvider extends AbstractWollokDslProposalProvider {
}

// messages to this
def dispatch void memberProposalsForTarget(WThis dis, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
def dispatch void memberProposalsForTarget(WSelf dis, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
dis.declaringContext.allMethods.forEach[ context.addProposal(it, acceptor) ]
}

Expand Down Expand Up @@ -88,7 +88,7 @@ class WollokDslProposalProvider extends AbstractWollokDslProposalProvider {
def dispatch asProposalParameter(WCollectionLiteral c) { "aCollection" }
def dispatch asProposalParameter(WObjectLiteral c) { "anObject" }
def dispatch asProposalParameter(WNullLiteral c) { "null" } //mmm
def dispatch asProposalParameter(WThis c) { "this" } //mmm
def dispatch asProposalParameter(WSelf c) { "this" } //mmm
def dispatch asProposalParameter(WExpression r) { "something" }

// *****************************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ WMemberFeatureCall returns WExpression:
FeatureCallID:
ID;

WThis returns WExpression:
{WThis} 'self'
WSelf returns WExpression:
{WSelf} 'self'
;

WPrimaryExpression returns WExpression:
Expand Down Expand Up @@ -269,7 +269,7 @@ WLiteral returns WExpression:
WNullLiteral |
WStringLiteral |
WObjectLiteral |
WThis |
WSelf |
WCollectionLiteral
;

Expand Down Expand Up @@ -342,12 +342,12 @@ WConstructor:
;

WDelegatingConstructorCall:
WThisDelegatingConstructorCall | WSuperDelegatingConstructorCall
WSelfDelegatingConstructorCall | WSuperDelegatingConstructorCall
;

// some how this should be referecens to WConstructor
WThisDelegatingConstructorCall:
{WThisDelegatingConstructorCall} 'self' '(' (arguments+=WExpression (',' arguments+=WExpression)*)? ')'
WSelfDelegatingConstructorCall:
{WSelfDelegatingConstructorCall} 'self' '(' (arguments+=WExpression (',' arguments+=WExpression)*)? ')'
;

// some how this should be referecens to WConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import org.uqbar.project.wollok.wollokDsl.WSetLiteral
import org.uqbar.project.wollok.wollokDsl.WStringLiteral
import org.uqbar.project.wollok.wollokDsl.WSuperInvocation
import org.uqbar.project.wollok.wollokDsl.WTest
import org.uqbar.project.wollok.wollokDsl.WThis
import org.uqbar.project.wollok.wollokDsl.WSelf
import org.uqbar.project.wollok.wollokDsl.WThrow
import org.uqbar.project.wollok.wollokDsl.WTry
import org.uqbar.project.wollok.wollokDsl.WUnaryOperation
Expand Down Expand Up @@ -335,7 +335,7 @@ class WollokInterpreterEvaluator implements XInterpreterEvaluator {

def dispatch Object evaluate(WUnaryOperation oper) { oper.feature.asUnaryOperation.apply(oper.operand.eval) }

def dispatch Object evaluate(WThis t) { interpreter.currentContext.thisObject }
def dispatch Object evaluate(WSelf t) { interpreter.currentContext.thisObject }

// member call
def dispatch Object evaluate(WFeatureCall call) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import org.uqbar.project.wollok.wollokDsl.WPostfixOperation
import org.uqbar.project.wollok.wollokDsl.WReturnExpression
import org.uqbar.project.wollok.wollokDsl.WStringLiteral
import org.uqbar.project.wollok.wollokDsl.WSuperInvocation
import org.uqbar.project.wollok.wollokDsl.WThis
import org.uqbar.project.wollok.wollokDsl.WSelf
import org.uqbar.project.wollok.wollokDsl.WTry
import org.uqbar.project.wollok.wollokDsl.WUnaryOperation
import org.uqbar.project.wollok.wollokDsl.WVariableReference
Expand Down Expand Up @@ -71,7 +71,7 @@ class WEvaluationExtension {
def static dispatch boolean isEvaluatesToAValue(WObjectLiteral it) { true }
def static dispatch boolean isEvaluatesToAValue(WNullLiteral it) { true }
def static dispatch boolean isEvaluatesToAValue(WBooleanLiteral it) { true }
def static dispatch boolean isEvaluatesToAValue(WThis it) { true }
def static dispatch boolean isEvaluatesToAValue(WSelf it) { true }
def static dispatch boolean isEvaluatesToAValue(WClosure it) { true }
def static dispatch boolean isEvaluatesToAValue(WVariableReference it) { true }
// ops
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import org.uqbar.project.wollok.wollokDsl.WReturnExpression
import org.uqbar.project.wollok.wollokDsl.WSuperDelegatingConstructorCall
import org.uqbar.project.wollok.wollokDsl.WSuperInvocation
import org.uqbar.project.wollok.wollokDsl.WTest
import org.uqbar.project.wollok.wollokDsl.WThisDelegatingConstructorCall
import org.uqbar.project.wollok.wollokDsl.WSelfDelegatingConstructorCall
import org.uqbar.project.wollok.wollokDsl.WVariable
import org.uqbar.project.wollok.wollokDsl.WVariableDeclaration
import org.uqbar.project.wollok.wollokDsl.WVariableReference
Expand Down Expand Up @@ -275,7 +275,7 @@ class WMethodContainerExtensions extends WollokModelExtensions {
// ** Constructors delegation, etc.
// ************************************************************************

def static dispatch resolveConstructorReference(WMethodContainer behave, WThisDelegatingConstructorCall call) { behave.resolveConstructor(call.arguments) }
def static dispatch resolveConstructorReference(WMethodContainer behave, WSelfDelegatingConstructorCall call) { behave.resolveConstructor(call.arguments) }
def static dispatch resolveConstructorReference(WMethodContainer behave, WSuperDelegatingConstructorCall call) { findConstructorInSuper(behave, call.arguments) }

def static findConstructorInSuper(WMethodContainer behave, Object[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import org.uqbar.project.wollok.wollokDsl.WProgram
import org.uqbar.project.wollok.wollokDsl.WReferenciable
import org.uqbar.project.wollok.wollokDsl.WStringLiteral
import org.uqbar.project.wollok.wollokDsl.WTest
import org.uqbar.project.wollok.wollokDsl.WThis
import org.uqbar.project.wollok.wollokDsl.WSelf
import org.uqbar.project.wollok.wollokDsl.WTry
import org.uqbar.project.wollok.wollokDsl.WVariable
import org.uqbar.project.wollok.wollokDsl.WVariableDeclaration
Expand Down Expand Up @@ -141,7 +141,7 @@ class WollokModelExtensions {

def static isCallOnVariableRef(WMemberFeatureCall c) { c.memberCallTarget instanceof WVariableReference }

def static isCallOnThis(WMemberFeatureCall c) { c.memberCallTarget instanceof WThis }
def static isCallOnThis(WMemberFeatureCall c) { c.memberCallTarget instanceof WSelf }

def static WMethodDeclaration resolveMethod(WMemberFeatureCall it) {
if (isCallOnThis)
Expand Down Expand Up @@ -215,7 +215,7 @@ class WollokModelExtensions {
def static dispatch isTransparent(WBlockExpression o) { true }
def static dispatch isTransparent(WIfExpression o) { true }
// literals or leafs
def static dispatch isTransparent(WThis o) { true }
def static dispatch isTransparent(WSelf o) { true }
def static dispatch isTransparent(WNumberLiteral o) { true }
def static dispatch isTransparent(WStringLiteral o) { true }
def static dispatch isTransparent(WBooleanLiteral o) { true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import org.uqbar.project.wollok.wollokDsl.WReferenciable
import org.uqbar.project.wollok.wollokDsl.WReturnExpression
import org.uqbar.project.wollok.wollokDsl.WSuperInvocation
import org.uqbar.project.wollok.wollokDsl.WTest
import org.uqbar.project.wollok.wollokDsl.WThis
import org.uqbar.project.wollok.wollokDsl.WSelf
import org.uqbar.project.wollok.wollokDsl.WTry
import org.uqbar.project.wollok.wollokDsl.WVariable
import org.uqbar.project.wollok.wollokDsl.WVariableDeclaration
Expand Down Expand Up @@ -159,7 +159,7 @@ class WollokDslValidator extends AbstractConfigurableDslValidator {

@Check
@DefaultSeverity(ERROR)
def cannotUseThisInConstructorDelegation(WThis it) {
def cannotUseThisInConstructorDelegation(WSelf it) {
if (EcoreUtil2.getContainerOfType(it, WDelegatingConstructorCall) != null)
report("Cannot access instance methods within constructor delegation.", it)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import org.uqbar.project.wollok.wollokDsl.WReturnExpression
import org.uqbar.project.wollok.wollokDsl.WStringLiteral
import org.uqbar.project.wollok.wollokDsl.WSuperInvocation
import org.uqbar.project.wollok.wollokDsl.WTest
import org.uqbar.project.wollok.wollokDsl.WThis
import org.uqbar.project.wollok.wollokDsl.WSelf
import org.uqbar.project.wollok.wollokDsl.WThrow
import org.uqbar.project.wollok.wollokDsl.WTry
import org.uqbar.project.wollok.wollokDsl.WUnaryOperation
Expand Down Expand Up @@ -123,5 +123,5 @@ class AbstractVisitor {
def dispatch void visit(WStringLiteral literal) {}
def dispatch void visit(WBooleanLiteral literal) {}
def dispatch void visit(WParameter param) {}
def dispatch void visit(WThis wthis) {}
def dispatch void visit(WSelf wthis) {}
}

0 comments on commit c9e61cd

Please sign in to comment.