diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-30 14:31:07 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-30 14:31:07 +0000 |
| commit | 0cf54b4f77ccf8376341950b02ceb7c1d1268ed7 (patch) | |
| tree | eebbba01063451c28f0a2e1cc048215f50beb98f /lib/CodeGen/ConstructorGen.cc | |
| parent | 4cb0d9b196008bc55dbfcdac1f9211dbbc879895 (diff) | |
refactor(strings): construct string values implicitly from raw literals
Keep double-quoted literals and text constants as C_STRING values. Use
marked STRING constructors for text and CHAR conversion, preserving
string operations and I/O through the existing class machinery.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'lib/CodeGen/ConstructorGen.cc')
| -rw-r--r-- | lib/CodeGen/ConstructorGen.cc | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/CodeGen/ConstructorGen.cc b/lib/CodeGen/ConstructorGen.cc index 81c448f..585249c 100644 --- a/lib/CodeGen/ConstructorGen.cc +++ b/lib/CodeGen/ConstructorGen.cc @@ -22,11 +22,9 @@ Value *CodeGen::emitOwnedValue(ExprAST *Expr, const TypeInfo *Type, expectResult(Expr, Type); if (!Type || (!Type->IsClass && !containsString(Type))) return emitCoercedExpr(Expr, Type); const TypeInfo *Source = getExprTypeInfo(Expr); - // A CHAR argument becomes a fresh STRING temporary, owned like any other. - bool FromChar = Source && Type->isString() && Source->Kind == TypeKind::Char; if (!Source) return emitCoercedExpr(Expr, Type); Value *Value = nullptr; - if (!FromChar && Source->sameType(Type) && isObjectLValue(Expr)) { + if (Source->sameType(Type) && isObjectLValue(Expr)) { LValueInfo LV; const auto *Var = dynamic_cast<VariableExprAST *>(Expr); const auto *Symbol = Var ? getSymbolInfo(Var->getName()) : nullptr; @@ -177,9 +175,7 @@ void CodeGen::emitAssignment(const LValueInfo &Target, ExprAST *Expr, const Symb return; } const TypeInfo *ExprType = getExprTypeInfo(Expr); - // A CHAR assigned to a STRING is converted first, not bound to OPERATOR<-. - bool CharToString = Info && Info->isString() && ExprType && ExprType->Kind == TypeKind::Char; - if (Info && Info->IsClass && !CharToString) { + if (Info && Info->IsClass) { auto Resolution = resolveOperator(tok_assign, Info, ExprType); if (Resolution.Ambiguous) { reportError("Ambiguous assignment operator"); |
