resolve()

in src/resolver/model.js [29:70]


  resolve() {
    const object = this.object;
    const combinator = this.combinator;
    const config = this.config;
    const ast = this.ast;

    assert.strictEqual(ast.type, 'model');

    combinator.config.emitType = 'model';

    object.name = ast.modelName.lexeme;
    if (config.modelDirName) {
      config.model.dir = config.modelDirName;
    }
    config.layer = config.model.dir;

    if (ast.annotation) {
      this.initAnnotation(ast.annotation);
    }

    object.topAnnotation.push(new AnnotationItem(
      object.index,
      'single',
      config.generateFileInfo
    ));

    object.addExtends(combinator.addInclude('$Model'));

    this.initProp(ast.modelBody.nodes);
    if (ast.modelBody.nodes.length === 0) {
      if (ast.tokenRange) {
        this.resolveAnnotations(
          this.getBetweenComments(ast.tokenRange[0], ast.tokenRange[1]),
          object.index
        ).forEach(c => {
          object.addBodyNode(c);
        });
      }
    }

    return object;
  }