Beispiel #1
0
        public override void Optimize(ref CodeNode _this, FunctionDefinition owner, InternalCompilerMessageCallback message, Options opts, FunctionInfo stats)
        {
            if (_reexportSourceModuleName != null)
            {
                return;
            }

            if (_internalDefinition != null)
            {
                CodeNode t = _internalDefinition;
                _internalDefinition.Optimize(ref t, owner, message, opts, stats);
                if (t != _internalDefinition)
                {
                    _internalDefinition = t as VariableDefinition;
                }
            }
            else
            {
                for (var i = 0; i < _map.Count; i++)
                {
                    var v = _map[i].Value;
                    _map[i].Value.Optimize(ref v, owner, message, opts, stats);
                    if (v != _map[i].Value)
                    {
                        _map[i] = new KeyValuePair <string, Expression>(_map[i].Key, v);
                    }
                }
            }
        }
Beispiel #2
0
 public override void Optimize(ref CodeNode _this, FunctionDefinition owner, InternalCompilerMessageCallback message, Options opts, FunctionInfo stats)
 {
     statement.Optimize(ref statement, owner, message, opts, stats);
     if (statement == null)
     {
         _this = null;
     }
 }
Beispiel #3
0
 public override void Optimize(ref CodeNode _this, FunctionDefinition owner, InternalCompilerMessageCallback message, Options opts, FunctionInfo stats)
 {
     _variable.Optimize(ref _variable, owner, message, opts, stats);
     _source.Optimize(ref _source, owner, message, opts, stats);
     if (_body != null)
     {
         _body.Optimize(ref _body, owner, message, opts, stats);
     }
 }
Beispiel #4
0
        public override void Optimize(ref CodeNode _this, FunctionDefinition owner, InternalCompilerMessageCallback message, Options opts, FunctionInfo stats)
        {
            _scope?.Optimize(ref _scope, owner, message, opts, stats);

            _body?.Optimize(ref _body, owner, message, opts, stats);

            if (_body == null)
            {
                _this = _scope;
            }
        }
Beispiel #5
0
        public override void Optimize(ref CodeNode _this, Expressions.FunctionDefinition owner, InternalCompilerMessageCallback message, Options opts, FunctionInfo stats)
        {
            body.Optimize(ref body, owner, message, opts, stats);

            if (catchBody != null)
            {
                catchBody.Optimize(ref catchBody, owner, message, opts, stats);
            }

            if (finallyBody != null)
            {
                finallyBody.Optimize(ref finallyBody, owner, message, opts, stats);
            }
        }
Beispiel #6
0
 public override void Optimize(ref CodeNode _this, Expressions.FunctionDefinition owner, InternalCompilerMessageCallback message, Options opts, FunctionInfo stats)
 {
     image.Optimize(ref image, owner, message, opts, stats);
     for (var i = 1; i < cases.Length; i++)
     {
         cases[i].statement.Optimize(ref cases[i].statement, owner, message, opts, stats);
     }
     for (var i = lines.Length; i-- > 0;)
     {
         if (lines[i] == null)
         {
             continue;
         }
         var cn = lines[i] as CodeNode;
         cn.Optimize(ref cn, owner, message, opts, stats);
         lines[i] = cn;
     }
 }
Beispiel #7
0
 public override void Optimize(ref CodeNode _this, FunctionDefinition owner, InternalCompilerMessageCallback message, Options opts, FunctionInfo stats)
 {
     if (_initializer != null)
     {
         _initializer.Optimize(ref _initializer, owner, message, opts, stats);
     }
     if (_condition != null)
     {
         _condition.Optimize(ref _condition, owner, message, opts, stats);
     }
     if (_post != null)
     {
         _post.Optimize(ref _post, owner, message, opts, stats);
     }
     if (_body != null)
     {
         _body.Optimize(ref _body, owner, message, opts, stats);
     }
 }
Beispiel #8
0
 public override void Optimize(ref CodeNode _this, Expressions.FunctionDefinition owner, CompilerMessageCallback message, Options opts, FunctionInfo stats)
 {
     body.Optimize(ref body, owner, message, opts, stats);
 }