UNPKG

ifc-expressions

Version:

Parsing and evaluation of IFC expressions

24 lines (23 loc) 913 B
import { Func } from "../Func.js"; import { FuncArg } from "../FuncArg.js"; import { ExprEvalSuccessObj } from "../../ExprEvalResult.js"; export class AttributeAccessorFunction extends Func { constructor(attributeName, returnType) { super(attributeName.toUpperCase(), [ new FuncArg(true, AttributeAccessorFunction.KEY_OBJECT_REF), ]); this.attributeName = attributeName; this.returnType = returnType; } getReturnType(argumentTypes) { return this.returnType; } calculateResult(callingExpr, evaluatedArguments) { const objectRef = evaluatedArguments .get(AttributeAccessorFunction.KEY_OBJECT_REF) .getValue(); return new ExprEvalSuccessObj(objectRef.getAttribute(this.attributeName)); } } AttributeAccessorFunction.KEY_OBJECT_REF = "objectRef"; //# sourceMappingURL=AttributeAccessorFunction.js.map