编译 if 节点

@param {ANode} aNode 节点对象
@param {CompileSourceBuffer} sourceBuffer 编译源码的中间buffer
@param {Component} owner 所属组件实例环境
497079
function (aNode, sourceBuffer, owner) {

        // output main if
        var ifDirective = aNode.directives['if']; // eslint-disable-line dot-notation
        sourceBuffer.addRaw('if (' + compileExprSource.expr(ifDirective.value) + ') {');
        sourceBuffer.addRaw(
            aNodeCompiler.compile(
                aNode.ifRinsed,
                sourceBuffer,
                owner
            )
        );
        sourceBuffer.addRaw('}');

        // output elif and else
        each(aNode.elses, function (elseANode) {
            var elifDirective = elseANode.directives.elif;
            if (elifDirective) {
                sourceBuffer.addRaw('else if (' + compileExprSource.expr(elifDirective.value) + ') {');
            }
            else {
                sourceBuffer.addRaw('else {');
            }

            sourceBuffer.addRaw(
                aNodeCompiler.compile(
                    elseANode,
                    sourceBuffer,
                    owner
                )
            );
            sourceBuffer.addRaw('}');
        });
    }
1193759
function(sType, aArgs, oSelf) {
        var source = aArgs[0];
        
        // Add source to the internal array of filters
        oSelf._sourceFilters.push(source);

        if(oSelf._elFt) {
            oSelf._createSourceCheckbox(source);
        }
    }
81473
function S(fn, value) {
    var owner = Owner, clock = RunningClock === null ? RootClock : RunningClock, running = RunningNode;
    if (owner === null)
        console.warn("computations created without a root or parent will never be disposed");
    var node = new ComputationNode(clock, fn, value);
    Owner = RunningNode = node;
    if (RunningClock === null) {
        toplevelComputation(node);
    }
    else {
        node.value = node.fn(node.value);
    }
    if (owner && owner !== UNOWNED) {
        if (owner.owned === null)
            owner.owned = [node];
        else
            owner.owned.push(node);
    }
    Owner = owner;
    RunningNode = running;
    return function computation() {
        if (RunningNode !== null) {
            var rclock = RunningClock, sclock = node.clock;
            while (rclock.depth > sclock.depth + 1)
                rclock = rclock.parent;
            if (rclock === sclock || rclock.parent === sclock) {
                if (node.preclocks !== null) {
                    for (var i = 0; i < node.preclocks.count; i++) {
                        var preclock = node.preclocks.clocks[i];
                        updateClock(preclock);
                    }
                }
                if (node.age === node.clock.time()) {
                    if (node.state === RUNNING)
                        throw new Error("circular dependency");
                    else
                        updateNode(node); // checks for state === STALE internally, so don't need to check here
                }
                if (node.preclocks !== null) {
                    for (var i = 0; i < node.preclocks.count; i++) {
                        var preclock = node.preclocks.clocks[i];
                        if (rclock === sclock)
                            logNodePreClock(preclock, RunningNode);
                        else
                            logClockPreClock(preclock, rclock, RunningNode);
                    }
                }
            }
            else {
                if (rclock.depth > sclock.depth)
                    rclock = rclock.parent;
                while (sclock.depth > rclock.depth + 1)
                    sclock = sclock.parent;
                if (sclock.parent === rclock) {
                    logNodePreClock(sclock, RunningNode);
                }
                else {
                    if (sclock.depth > rclock.depth)
                        sclock = sclock.parent;
                    while (rclock.parent !== sclock.parent)
                        rclock = rclock.parent, sclock = sclock.parent;
                    logClockPreClock(sclock, rclock, RunningNode);
                }
                updateClock(sclock);
            }
            logComputationRead(node, RunningNode);
        }
        return node.value;
    };
}
573504
function _assignGenerator(own) {
    let _copy = function(target, ...source) {
        let deep = true;
        if (is.Boolean(target)) {
            deep = target;
            target = 0 in source
                ? source.shift()
                : null;
        }

        if (is.Array(target)) {
            source.forEach(sc => {
                target.push(...sc);
            });
        } else if (is.Object(target)) {
            source.forEach(sc => {
                for (let key in sc) {
                    if (own && !sc.hasOwnProperty(key))
                        continue;
                    let so = sc[key],
                        to = target[key];
                    if (is.PureObject(so)) {
                        target[key] = deep
                            ? extend(true, is.PureObject(to)
                                ? to
                                : {}, so)
                            : so;
                    } else if (is.Array(so)) {
                        target[key] = deep
                            ? extend(true, is.Array(to)
                                ? to
                                : [], so)
                            : so;
                    } else {
                        target[key] = so;
                    }
                }
            });
        }
        // Do nothing
        return target;
    };
    return _copy;
}
146098
function() {
    if ("production" !== "development") {
      var owner = ReactCurrentOwner.current;
      if (owner !== null) {
        ("production" !== "development" ? warning(
          owner._warnedAboutRefsInRender,
          '%s is accessing isMounted inside its render() function. ' +
          'render() should be a pure function of props and state. It should ' +
          'never access something that requires stale data from the previous ' +
          'render, such as refs. Move this logic to componentDidMount and ' +
          'componentDidUpdate instead.',
          owner.getName() || 'A component'
        ) : null);
        owner._warnedAboutRefsInRender = true;
      }
    }
    var internalInstance = ReactInstanceMap.get(this);
    return (
      internalInstance &&
      internalInstance !== ReactLifeCycle.currentlyMountingInstance
    );
  }
323830
function(ctx, frame, cb) {
                // ... 如果是 .render(function () {})
                if (typeof ctx === 'function') {
                    cb = ctx;
                    ctx = {};
                } 
                // ...? 什么场景使用了frame
                else if (typeof frame === 'function') {
                    cb = frame;
                    frame = null;
                }

                return lib.withPrettyErrors(this.path, this.env.dev, function() {
                    // debugger;
                    this.compile();

                    // ... 当前作用域不是简单的Object对象，是Context类的实例，并且整合了blocks对象
                    // ...todo 整合了blocks对象的情景分析
                    var context = new Context(ctx || {}, this.blocks);
                    var syncResult = null;

                    frame = frame || new Frame()

                    this.rootRenderFunc(this.env, context, frame, runtime, cb || function(err, res) {
                        if (err) {
                            throw err;
                        }
                        syncResult = res;
                    });

                    return syncResult;
                }.bind(this));
            }
432195
public static boolean isNamedElement(final Node aNode) {

        final boolean isElementNode = aNode != null && aNode.getNodeType() == Node.ELEMENT_NODE;

        return isElementNode
                && getNamedAttribute(aNode, NAME_ATTRIBUTE) != null
                && !getNamedAttribute(aNode, NAME_ATTRIBUTE).isEmpty();
    }
739084
function compile( src ) {
    var watch  = arguments.length <= 1 || arguments[1] === void 0 ? true : arguments[1];
    var parent = arguments.length <= 2 || arguments[2] === void 0 ? null : arguments[2];

    var script = new SourceScript( src, parent );

    if( watch ) {
        script.watch();
    }

    return script;
}
719119
function(ev) {
          if (sourceElem === target[0] && ev.target === target[0]) {
            ev.stopPropagation();
            ev.preventDefault();

            smartClose();
          }
        }
144935
function(_type,_source,_real){
            var _id = _e._$id(_source.element),
                _cch_id = _xcache[_id]||{},
                _cch_tp = _cch_id[_type]||[];
            _cch_tp.push({
                type:_real.type||_type,
                func:_real.handler||_source.handler,
                sfun:_source.handler,
                capt:_source.capture,
                link:_real.link,
                destroy:_real.destroy
            });
            _cch_id[_type] = _cch_tp;
            _xcache[_id] = _cch_id;
        }
681247
function compileJSSource(ComponentClass) {
    var sourceBuffer = new CompileSourceBuffer();
    var contextId = genSSRId();

    sourceBuffer.addRendererStart();
    var renderId = compileComponentSource(sourceBuffer, ComponentClass, contextId);
    sourceBuffer.addRaw('return componentRenderers.' + renderId + '(data, noDataOutput)');
    sourceBuffer.addRendererEnd();

    return sourceBuffer.toCode();
}
468318
public final void write (@Nonnull final NODETYPE aNode, @Nonnull @WillNotClose final OutputStream aOS)
  {
    ValueEnforcer.notNull (aNode, "Node");
    ValueEnforcer.notNull (aOS, "OutputStream");

    // Create a writer for the passed output stream
    final NonBlockingBufferedWriter aWriter = new NonBlockingBufferedWriter (StreamHelper.createWriter (aOS,
                                                                                                        m_aSettings.getCharset ()));
    // Inside the other write method, the writer must be flushed!
    write (aNode, aWriter);
    // Do not close the writer!
  }
163893
function compileSourcePreCode() {
    var $version = '##version##';

    var componentRenderers = {};

    function extend(target, source) {
        if (source) {
            Object.keys(source).forEach(function (key) {
                var value = source[key];
                if (typeof value !== 'undefined') {
                    target[key] = value;
                }
            });
        }

        return target;
    }

    function each(array, iterator) {
        if (array && array.length > 0) {
            for (var i = 0, l = array.length; i < l; i++) {
                if (iterator(array[i], i) === false) {
                    break;
                }
            }
        }
    }

    function contains(array, value) {
        var result;
        each(array, function (item) {
            result = item === value;
            return !result;
        });

        return result;
    }

    var HTML_ENTITY = {
        /* jshint ignore:start */
        '&': '&amp;',
        '<': '&lt;',
        '>': '&gt;',
        '"': '&quot;',
        /* eslint-disable quotes */
        "'": '&#39;'
        /* eslint-enable quotes */
        /* jshint ignore:end */
    };

    function htmlFilterReplacer(c) {
        return HTML_ENTITY[c];
    }

    function escapeHTML(source) {
        if (source == null) {
            return '';
        }

        if (typeof source === 'string') {
            return source ? source.replace(/[&<>"']/g, htmlFilterReplacer) : '';
        }

        return '' + source;
    }

    function _classFilter(source) {
        if (source instanceof Array) {
            return source.join(' ');
        }

        return source;
    }

    function _styleFilter(source) {
        if (typeof source === 'object') {
            var result = '';
            if (source) {
                Object.keys(source).forEach(function (key) {
                    result += key + ':' + source[key] + ';';
                });
            }

            return result;
        }

        return source;
    }

    function _xclassFilter(source) {
        if (source instanceof Array) {
            source = source.join(' ');
        }

        return source ? ' ' + source : '';
    }

    function _xstyleFilter(source) {
        var result;
        if (typeof source === 'object') {
            result = '';
            if (source) {
                Object.keys(source).forEach(function (key) {
                    result += key + ':' + source[key] + ';';
                });
            }
        }
        else {
            result = source;
        }

        return result ? ';' + result : '';
    }

    function attrFilter(name, value) {
        if (value) {
            return ' ' + name + '="' + value + '"';
        }

        return '';
    }

    function boolAttrFilter(name, value) {
        if (value && value !== 'false' && value !== '0') {
            return ' ' + name;
        }

        return '';
    }

    function callFilter(ctx, name, args) {
        var filter = ctx.proto.filters[name];
        if (typeof filter === 'function') {
            return filter.apply(ctx, args);
        }
    }
}
1351924
@Override
  public int owner(int hash)
  {
    NodePodAmp delegate = delegate();
    
    if (delegate != null) {
      return delegate().owner(hash);
    }
    else {
      return 0;
    }
  }
219532
protected boolean verifyCondition1(IContextMapping<INode> mapping, INode source, INode target) {
        return findRelation(mapping, IMappingElement.LESS_GENERAL, source.getAncestorsList(), target) ||
                findRelation(mapping, IMappingElement.LESS_GENERAL, source, target.getDescendantsList()) ||
                findRelation(mapping, IMappingElement.LESS_GENERAL, source.getAncestorsList(), target.getDescendantsList()) ||

                findRelation(mapping, IMappingElement.EQUIVALENCE, source.getAncestorsList(), target) ||
                findRelation(mapping, IMappingElement.EQUIVALENCE, source, target.getDescendantsList()) ||
                findRelation(mapping, IMappingElement.EQUIVALENCE, source.getAncestorsList(), target.getDescendantsList());
    }
1109897
function parents(instance, context) {
            var results = []
            var parent
            if (context === undefined) return results

            // parents(instance, array)
            if (!Util.isString(context) && !context.nodeType && context.length) {
                Util.each(context, function(item /*, index*/ ) {
                    results = results.concat(parents(instance, item))
                })
                return results
            }

            // 从当前组件 instance 开始，逐层向上遍历

            // parents(instance, component)
            if (context.options && context.render) {
                parent = instance

                // 在 instance 的祖先元素中，查找与 context.clientId 匹配的元素
                while ((parent = CACHE[parent.parentClientId])) {
                    if (parent.clientId === context.clientId) {
                        results.push(parent)
                        break
                    }
                }

            } else if (context.nodeType) {
                // parents(instance, element)
                parent = instance.element

                // 在 instance 的祖先元素中，查找与 context 相等的元素
                while ((parent = parent.parentNode)) {
                    if (parent === context) {
                        results.push(parent)
                        break
                    }
                }

            } else {
                // parents(instance, moduleId)    
                parent = instance

                // 在 instance 的祖先元素中，查找与 context 匹配的元素
                while ((parent = CACHE[parent.parentClientId])) {
                    if (parent.moduleId === context) {
                        results.push(parent)
                    }
                }
            }

            return results
        }
148483
function SlotNode(aNode, parent, scope, owner, reverseWalker) {
    this.owner = owner;
    this.scope = scope;
    this.parent = parent;
    this.parentComponent = parent.nodeType === NodeType.CMPT
        ? parent
        : parent.parentComponent;

    this.id = guid++;

    this.lifeCycle = LifeCycle.start;
    this.children = [];

    // calc slot name
    this.nameBind = getANodeProp(aNode, 'name');
    if (this.nameBind) {
        this.isNamed = true;
        this.name = evalExpr(this.nameBind.expr, this.scope, this.owner);
    }

    // calc aNode children
    var sourceSlots = owner.sourceSlots;
    var matchedSlots;
    if (sourceSlots) {
        matchedSlots = this.isNamed ? sourceSlots.named[this.name] : sourceSlots.noname;
    }

    if (matchedSlots) {
        this.isInserted = true;
    }

    this.aNode = {
        directives: aNode.directives,
        props: [],
        events: [],
        children: matchedSlots || aNode.children.slice(0),
        vars: aNode.vars
    };

    // calc scoped slot vars
    var initData;
    if (nodeSBindInit(this, aNode.directives.bind)) {
        initData = extend({}, this._sbindData);
    }

    if (aNode.vars) {
        initData = initData || {};
        each(aNode.vars, function (varItem) {
            initData[varItem.name] = evalExpr(varItem.expr, scope, owner);
        });
    }

    // child owner & child scope
    if (this.isInserted) {
        this.childOwner = owner.owner;
        this.childScope = owner.scope;
    }

    if (initData) {
        this.isScoped = true;
        this.childScope = new Data(initData, this.childScope || this.scope);
    }


    owner.slotChildren.push(this);

    // #[begin] reverse
    if (reverseWalker) {

        this.sel = document.createComment(this.id);
        insertBefore(this.sel, reverseWalker.target, reverseWalker.current);

        var me = this;
        each(this.aNode.children, function (aNodeChild) {
            me.children.push(createReverseNode(
                aNodeChild,
                me,
                me.childScope || me.scope,
                me.childOwner || me.owner,
                reverseWalker
            ));
        });

        this.el = document.createComment(this.id);
        insertBefore(this.el, reverseWalker.target, reverseWalker.current);

        this.lifeCycle = LifeCycle.attached;
    }
    // #[end]
}