@finos/legend-graph
Version:
Legend graph and graph manager
59 lines • 2.44 kB
JavaScript
/**
* Copyright (c) 2020-present, Goldman Sachs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { computed, makeObservable, observable } from 'mobx';
import { observe_PackageableElementReference, skipObserved, skipObservedWithContext, } from './CoreObserverHelper.js';
export const observe_RawPrimitiveInstanceValue = skipObserved((metamodel) => {
makeObservable(metamodel, {
value: observable,
hashCode: computed,
});
observe_PackageableElementReference(metamodel.type);
return metamodel;
});
export const observe_RawLambda = skipObserved((metamodel) => makeObservable(metamodel, {
body: observable.ref, // only observe the reference, the object itself is not observed
parameters: observable.ref, // only observe the reference, the object itself is not observed
hashCode: computed,
}));
export const observe_RawVariableExpression = skipObserved((metamodel) => {
makeObservable(metamodel, {
name: observable,
multiplicity: observable,
hashCode: computed,
});
observe_PackageableElementReference(metamodel.type);
return metamodel;
});
class RawValueSpecificationObserver {
observerContext;
constructor(observerContext) {
this.observerContext = observerContext;
}
visit_RawLambda(valueSpecification) {
observe_RawLambda(valueSpecification);
}
visit_RawVariableExpression(valueSpecification) {
observe_RawVariableExpression(valueSpecification);
}
visit_RawPrimitiveInstanceValue(valueSpecification) {
observe_RawPrimitiveInstanceValue(valueSpecification);
}
}
export const observe_RawValueSpecification = skipObservedWithContext((rawValueSpecification, context) => {
rawValueSpecification.accept_RawValueSpecificationVisitor(new RawValueSpecificationObserver(context));
return rawValueSpecification;
});
//# sourceMappingURL=RawValueSpecificationObserver.js.map