# This file is part of NIT ( http://www.nitlanguage.org ). # # 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. # Create a model from nit source files module modelize import modelize_property redef class ModelBuilder # Retrieve the associated AST node of a mentity. # This method is used to associate model entity with syntactic entities. # # If the mentity is not associated with a node, returns null. # This is always the case for MPackage, Mgroup, MClass and MProperty. # MModule, MClassDef and MPropDef can also have no node associated # (like fictive modules of generated attributes/methods). fun mentity2node(mentity: MEntity): nullable ANode do if mentity isa MModule then return mmodule2node(mentity) else if mentity isa MClassDef then return mclassdef2node(mentity) else if mentity isa MPropDef then return mpropdef2node(mentity) end return null end end