lib/read.js
function resolveReferences() {

    var elementsById = context.elementsById;
    var references = context.references;

    var i, r;

    for (i = 0; (r = references[i]); i++) {
      var element = r.element;
      var reference = elementsById[r.id];
      var property = getModdleDescriptor(element).propertiesByName[r.property];

      if (!reference) {
        context.addWarning({
          message: 'unresolved reference <' + r.id + '>',
          element: r.element,
          property: r.property,
          value: r.id
        });
      }

      if (property.isMany) {
        var collection = element.get(property.name),
            idx = collection.indexOf(r);

        // we replace an existing place holder (idx != -1) or
        // append to the collection instead
        if (idx === -1) {
          idx = collection.length;
        }

        if (!reference) {
          // remove unresolvable reference
          collection.splice(idx, 1);
        } else {
          // add or update reference in collection
          collection[idx] = reference;
        }
      } else {
        element.set(property.name, reference);
      }
    }
  }
function resolveReferences() {

    var elementsById = context.elementsById;
    var references = context.references;

    var i, r;

    for (i = 0; (r = references[i]); i++) {
      var element = r.element;
      var reference = elementsById[r.id];
      var property = getModdleDescriptor(element).propertiesByName[r.property];

      if (!reference) {
        context.addWarning({
          message: 'unresolved reference <' + r.id + '>',
          element: r.element,
          property: r.property,
          value: r.id
        });
      }

      if (property.isMany) {
        var collection = element.get(property.name),
            idx = collection.indexOf(r);

        // we replace an existing place holder (idx != -1) or
        // append to the collection instead
        if (idx === -1) {
          idx = collection.length;
        }

        if (!reference) {
          // remove unresolvable reference
          collection.splice(idx, 1);
        } else {
          // add or update reference in collection
          collection[idx] = reference;
        }
      } else {
        element.set(property.name, reference);
      }
    }
  }
function resolveReferences ( ) { var elementsById = context . elementsById ; var references = context . references ; var i , r ; for ( i = 0 ; ( r = references [ i ] ) ; i ++ ) { var element = r . element ; var reference = elementsById [ r . id ] ; var property = getModdleDescriptor ( element ) . propertiesByName [ r . property ] ; if ( ! reference ) { context . addWarning ( { message : 'unresolved reference <' + r . id + '>' , element : r . element , property : r . property , value : r . id } ) ; } if ( property . isMany ) { var collection = element . get ( property . name ) , idx = collection . indexOf ( r ) ; // we replace an existing place holder (idx != -1) or // append to the collection instead if ( idx === - 1 ) { idx = collection . length ; } if ( ! reference ) { // remove unresolvable reference collection . splice ( idx , 1 ) ; } else { // add or update reference in collection collection [ idx ] = reference ; } } else { element . set ( property . name , reference ) ; } } }
Resolve collected references on parse end.
Resolve collected references on parse end .