public VariableFlags IdentifierName( INameExpression nameExpression, VariableFlags liveVariables) { SetLiveness(nameExpression.ReferencedSymbol, nameExpression.VariableIsLiveAfter, liveVariables); return(liveVariables.Set(nameExpression.ReferencedSymbol, true)); }
public VariableFlags IdentifierName( INameExpression nameExpression, VariableFlags possiblyMoved) { var symbol = nameExpression.ReferencedSymbol; if (possiblyMoved[symbol] == true) { diagnostics.Add(SemanticError.UseOfPossiblyMovedValue(file, nameExpression.Span)); } var valueSemantics = nameExpression.Semantics; // TODO this isn't correct, but for now fields don't have proper move, borrow handling //?? nameExpression.Type.Assigned().OldValueSemantics; switch (valueSemantics) { case ExpressionSemantics.Move: case ExpressionSemantics.Acquire: return(possiblyMoved.Set(symbol, true)); case ExpressionSemantics.Copy: case ExpressionSemantics.Borrow: case ExpressionSemantics.Share: case ExpressionSemantics.Void: case ExpressionSemantics.Never: case ExpressionSemantics.CreateReference: // If it were move or copy, that would have been set to the ExpressionSemantics // Not moving value return(possiblyMoved); default: throw ExhaustiveMatch.Failed(valueSemantics); } }
public ForCatchExpression(INameExpression index, IRightExpression begin, IRightExpression end, IExpression entry) { _index = index; _begin = begin; _end = end; _step = new NumberExpression(1); _entry = new FuncExpression(new[] { _index.Name }, entry); }
public ForExpression(INameExpression index, IRightExpression begin, IRightExpression end, IRightExpression step, IExpression entry) { _index = index; _begin = begin; _end = end; _step = step; _entry = entry; }
public VariableFlags Assignment( IAssignmentExpression assignmentExpression, VariableFlags definitelyAssigned) { return(assignmentExpression.LeftOperand switch { INameExpression identifier => definitelyAssigned.Set(identifier.ReferencedSymbol, true), IFieldAccessExpression _ => definitelyAssigned, _ => throw new NotImplementedException("Complex assignments not yet implemented") });
public ForEachCatchExpression(INameExpression index, IRightExpression list, IExpression entry) { _index = index; _list = list; _entry = new FuncExpression(new[] { _index.Name }, entry); }
public ForEachExpression(INameExpression index, IRightExpression list, IExpression entry) { _index = index; _list = list; _entry = entry; }
public virtual void ExitINameExpression(INameExpression iNameExpression) { }
public virtual void EnterINameExpression(INameExpression iNameExpression) { }
public PropertyExpression(IRightExpression target, INameExpression property) { _target = target; _property = property; }
public VariableFlags IdentifierName( INameExpression nameExpression, VariableFlags definitelyUnassigned) { return(definitelyUnassigned); }