Skip to content

Commit

Permalink
Added support for non-qualified operations #147
Browse files Browse the repository at this point in the history
Non-qualified operation names are resolved as
StaticFeatureInvocationExpressions.
  • Loading branch information
ujhelyiz committed Aug 13, 2015
1 parent 4e05176 commit 45ff8e6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,24 @@ import com.incquerylabs.uml.ralf.ReducedAlfSystem
import com.incquerylabs.uml.ralf.reducedAlfLanguage.AssociationAccessExpression
import com.incquerylabs.uml.ralf.reducedAlfLanguage.Block
import com.incquerylabs.uml.ralf.reducedAlfLanguage.Expression
import com.incquerylabs.uml.ralf.reducedAlfLanguage.FeatureInvocationExpression
import com.incquerylabs.uml.ralf.reducedAlfLanguage.FilterExpression
import com.incquerylabs.uml.ralf.reducedAlfLanguage.ForEachStatement
import com.incquerylabs.uml.ralf.reducedAlfLanguage.ForStatement
import com.incquerylabs.uml.ralf.reducedAlfLanguage.PropertyAccessExpression
import com.incquerylabs.uml.ralf.reducedAlfLanguage.Statement
import com.incquerylabs.uml.ralf.reducedAlfLanguage.Statements
import com.incquerylabs.uml.ralf.reducedAlfLanguage.StaticFeatureInvocationExpression
import com.incquerylabs.uml.ralf.reducedAlfLanguage.Variable
import com.incquerylabs.uml.ralf.types.IUMLTypeReference
import com.incquerylabs.uml.ralf.types.UMLTypeReference
import org.eclipse.emf.ecore.EObject
import org.eclipse.emf.ecore.EReference
import org.eclipse.uml2.uml.Class
import org.eclipse.xtext.naming.IQualifiedNameConverter
import org.eclipse.xtext.scoping.IScope
import org.eclipse.xtext.scoping.Scopes
import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider
import com.incquerylabs.uml.ralf.types.UMLTypeReference
import com.incquerylabs.uml.ralf.reducedAlfLanguage.ForStatement
import com.incquerylabs.uml.ralf.reducedAlfLanguage.FeatureInvocationExpression
import com.incquerylabs.uml.ralf.types.IUMLTypeReference
import com.incquerylabs.uml.ralf.reducedAlfLanguage.ForEachStatement
import com.incquerylabs.uml.ralf.reducedAlfLanguage.FilterExpression
import com.incquerylabs.uml.ralf.reducedAlfLanguage.StaticFeatureInvocationExpression
import org.eclipse.xtext.naming.QualifiedName
import org.eclipse.xtext.naming.IQualifiedNameConverter

/**
* This class contains custom scoping description.
Expand Down Expand Up @@ -183,11 +182,20 @@ class ReducedAlfLanguageScopeProvider extends AbstractDeclarativeScopeProvider {
}

def IScope scope_StaticFeatureInvocationExpression_operation(StaticFeatureInvocationExpression ctx, EReference ref) {
Scopes.scopeFor(umlContext.getStaticOperations(),
val staticScope = Scopes.scopeFor(umlContext.getStaticOperations(),
//XXX is this name conversion correct?
[nameConverter.toQualifiedName('''«namespace.name»::«name»''')],
IScope.NULLSCOPE
)
val thisType = umlContext.thisType
if (thisType != null) {
Scopes.scopeFor(umlContext.getOperationsOfClass(thisType),
[nameConverter.toQualifiedName(name)],
staticScope
)
} else {
staticScope
}
}

def IScope scope_PropertyAccessExpression_property(PropertyAccessExpression ctx, EReference ref) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ class UMLOperationValidatorTest {
}

@Test
@Ignore("Non-qualified operations not supported")
def operationPongParameterIniline_NoThis(){
operationOKThis(
'''
Expand Down Expand Up @@ -263,7 +262,6 @@ class UMLOperationValidatorTest {
}

@Test
@Ignore("Non-qualified operations not supported")
def operationPongParameterOperation_NoThis(){
operationOKThis(
'''
Expand All @@ -273,7 +271,7 @@ class UMLOperationValidatorTest {
}

@Test
@Ignore("Non-qualified operations not supported")
@Ignore("Operation parameter validation not yet implemented")
def operationPongParameterOperation_Invalid_NoThis(){
operationErrorThis(
'''
Expand Down Expand Up @@ -303,7 +301,6 @@ class UMLOperationValidatorTest {
}

@Test
@Ignore("Non-qualified operations not supported")
def operationPingSignalParameterInline_NoThis(){
operationOKThis(
'''
Expand All @@ -322,7 +319,6 @@ class UMLOperationValidatorTest {
}

@Test
@Ignore("Non-qualified operations not supported")
def operationPingSignalParameterOperation_NoThis(){
operationOKThis(
'''
Expand Down Expand Up @@ -408,7 +404,6 @@ class UMLOperationValidatorTest {
}

@Test
@Ignore("Non-qualified operations not supported")
def operationReturnPingSignalAssignment_NoThis(){
operationOKThis(
'''
Expand All @@ -419,7 +414,6 @@ class UMLOperationValidatorTest {
}

@Test
@Ignore("Non-qualified operations not supported")
def operationReturnPingSignalAssignment_Invalid_NoThis(){
operationErrorThis(
'''
Expand All @@ -430,7 +424,6 @@ class UMLOperationValidatorTest {
}

@Test
@Ignore("Non-qualified operations not supported")
def operationReturnPongAssignment_NoThis(){
operationOKThis(
'''
Expand All @@ -441,7 +434,6 @@ class UMLOperationValidatorTest {
}

@Test
@Ignore("Non-qualified operations not supported")
def operationReturnPongOperationCall_NoThis(){
operationOKThis(
'''
Expand All @@ -451,7 +443,6 @@ class UMLOperationValidatorTest {
}

@Test
@Ignore("Non-qualified operations not supported")
def operationReturnIntegerAssignment_NoThis(){
operationOKThis(
'''
Expand All @@ -462,7 +453,6 @@ class UMLOperationValidatorTest {
}

@Test
@Ignore("Non-qualified operations not supported")
def operationReturnIntegerAdditive_NoThis(){
operationOKThis(
'''
Expand All @@ -472,7 +462,6 @@ class UMLOperationValidatorTest {
}

@Test
@Ignore("Non-qualified operations not supported")
def operationReturnIntegerMultiplicative_NoThis(){
operationOKThis(
'''
Expand All @@ -482,7 +471,6 @@ class UMLOperationValidatorTest {
}

@Test
@Ignore("Non-qualified operations not supported")
def operationReturnIntegerShift_NoThis(){
operationOKThis(
'''
Expand Down Expand Up @@ -540,7 +528,6 @@ class UMLOperationValidatorTest {
}

@Test
@Ignore("Non-qualified operations not supported")
def operationOptionalParameter_NoThis(){
operationOKThis(
'''
Expand All @@ -559,7 +546,6 @@ class UMLOperationValidatorTest {
}

@Test
@Ignore("Non-qualified operations not supported")
def operationOptionalParameter_Default_NoThis(){
operationOKThis(
'''
Expand All @@ -579,7 +565,7 @@ class UMLOperationValidatorTest {
}

@Test
@Ignore("Non-qualified operations not supported")
@Ignore("Operation parameter validation not yet implemented")
def operationOptionalParameter_Invalid_NoThis(){
operationErrorThis(
'''
Expand Down

0 comments on commit 45ff8e6

Please sign in to comment.