Skip to main content
summaryrefslogtreecommitdiffstats
blob: 561002fec681e3a0f2dbc8e56ef222dec4aaa929 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import  cs : 'ClassesCS.ecore#/'
import  as : 'Classes.ecore#/'
import 'classescs2asV2Helpers.ocl'
import 'classescs2asV2Lookup.ocl'
import 'classescs2asV2Disambiguation.ocl'
package cs

context RootCS
def : ast() : as::Root =
	as::Root {
		ownedPackages = ownedPackages.ast() 
	}
context PackageCS
def : ast() : as::Package =
	as::Package {
		name = name, 
	ownedClasses = ownedClasses.ast(), 
	ownedPackages = ownedPackages.ast() 
	}
context ClassCS
def : ast() : as::Class =
	as::Class {
		name = name, 
	ownedOperations = operations.ast(), 
	ownedProperties = properties.ast(), 
	superClass = if _extends = null then null else ast().lookupClass(_extends) endif 
	}
context PropertyCS
def : ast() : as::Property =
	as::Property {
		name = name, 
	type = ast().lookupClass(typeRef) 
	}
context OperationCS
def : ast() : as::Operation =
	as::Operation {
		name = name, 
	type = ast().lookupClass(resultRef), 
	ownedParameters = params->collect(x | classes::Parameter{
					name = x
				}), 
	ownedExpressions = bodyExps.ast() 
	}
context NameExpCS
def : ast() : as::CallExp =
	if isOpCallExp()
	then as::OperationCallExp {
		ownedCallExp = ownedNameExp?.ast(),
		ownedArguments = roundedBrackets.args.ast(), 
	referredOperation = if oclContainer().oclIsKindOf(NameExpCS) then ast().lookupOperationFrom(ast().owningSource.type, name, ast().oclAsType(as::OperationCallExp).ownedArguments) else ast().lookupOperation(name, ast().oclAsType(as::OperationCallExp).ownedArguments) endif, 
	type = ast().oclAsType(as::OperationCallExp).referredOperation?.type
	}
	else
		if isPropCallExp()
		then as::PropertyCallExp {
			ownedCallExp = ownedNameExp?.ast(), 
		referredProperty = if oclContainer().oclIsKindOf(NameExpCS) then ast().lookupPropertyFrom(ast().owningSource.type, name) else ast().lookupProperty(name) endif, 
		type = ast().oclAsType(as::PropertyCallExp).referredProperty?.type
		}
		else
			invalid
		endif
	endif
context ArgumentCS
def : ast() : as::Argument =
	as::Argument {
		name = name 
	}
endpackage

Back to the top