public AstObjectCreation(string file, int line, int col, AstTypeExpr type) : base(file, line, col) { if (type == null) throw new ArgumentNullException("type"); _typeExpr = type; _proxy = new ArgumentsProxy(_arguments); }
public AstTypecast(string file, int line, int column, AstExpr subject, AstTypeExpr type) : base(file, line, column) { if (subject == null) throw new ArgumentNullException("subject"); if (type == null) throw new ArgumentNullException("type"); Subject = subject; Type = type; }
public AstGetSetStatic( string file, int line, int col, PCall call, AstTypeExpr typeExpr, string memberId) : base(file, line, col, call) { if (typeExpr == null) throw new ArgumentNullException("typeExpr"); if (memberId == null) throw new ArgumentNullException("memberId"); TypeExpr = typeExpr; _memberId = memberId; }
public override bool TryOptimize(CompilerTarget target, out AstExpr expr) { expr = null; _typeExpr = (AstTypeExpr) _GetOptimizedNode(target, _typeExpr); //Optimize arguments for (var i = 0; i < _arguments.Count; i++) { var arg = _arguments[i]; var oArg = _GetOptimizedNode(target, arg); if (ReferenceEquals(oArg, arg)) continue; _arguments[i] = oArg; } return false; }
internal AstObjectCreation(Parser p, AstTypeExpr type) : this(p.scanner.File, p.t.line, p.t.col, type) { }
internal AstTypecast(Parser p, AstExpr subject, AstTypeExpr type) : this(p.scanner.File, p.t.line, p.t.col, subject, type) { }
internal AstGetSetStatic(Parser p, PCall call, AstTypeExpr typeExpr, string memberId) : this(p.scanner.File, p.t.line, p.t.col, call, typeExpr, memberId) { }
public override bool TryOptimize(CompilerTarget target, out AstExpr expr) { _OptimizeNode(target, ref _subject); _type = (AstTypeExpr) _GetOptimizedNode(target, _type); expr = null; var constSubject = _subject as AstConstant; var constType = _type as AstConstantTypeExpression; if (constSubject == null || constType == null) return false; PType type; try { type = target.Loader.ConstructPType(constType.TypeExpression); } catch (PrexoniteException) { //ignore, cast failed. cannot be optimized return false; } expr = new AstConstant(File, Line, Column, constSubject.ToPValue(target).Type.Equals(type)); return true; }