9.3.42 LetExpSubCS
[A] LetExpSubCS[1] ::= ‘,’ VariableDeclarationCS LetExpSubCS[2]
[B] LetExpSubCS ::= ‘in’ OclExpressionCS
抽象语法映射
LetExpSubCS.ast : OclExpression
合成的属性
[A] LetExpSubCS[1].ast.oclAsType(LetExp).variable = VariableDeclarationCS.ast
[A] LetExpSubCS[1].ast.oclAsType(LetExp).OClExpression = LetExpSubCS[2].ast
[B] LetExpSubCS.ast = OclExpressionCS.ast
继承的属性
[A] VariableDeclarationCS.env = LetExpSubCS[1].env
[A] LetExpSubCS[2].env = LetExpSubCS[1].env.nestedEnvironment().addElement(
VariableDeclarationCS.ast.varName,
VariableDeclarationCS.ast,
false)
[B] OClExpressionCS.env = LetExpSubCS.env
歧义消除规则
[A] 变量名在当前范围内必须是唯一的。
LetExpCS.env.lookup (VariableDeclarationCS.ast.varName).oclIsUndefined()
[B] let中的变量声明必须有一个类型和初始值。
not VariableDeclarationCS.ast.type.oclIsUndefined() and
VariableDeclarationCS.ast.initExpression->notEmpty()