Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/codegen/expressions/method-calls/string-methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ export function handleReplace(
const replaceArg = expr.args[1];

if (searchArg.type === "regex") {
const regexNode = searchArg as { pattern: string; flags: string };
const regexNode = searchArg as { type: string; pattern: string; flags: string };
const isGlobal = regexNode.flags.indexOf("g") !== -1;
const searchStr = ctx.stringGen.doGenerateGlobalString(regexNode.pattern);
const replaceStr = ctx.generateExpression(replaceArg, params);
Expand Down
2 changes: 1 addition & 1 deletion src/codegen/infrastructure/type-inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1810,7 +1810,7 @@ export class TypeInference {
let e = expr as ExprBase;
let indexExpr: Expression = expr;
if (e.type === "type_assertion") {
const assertion = expr as { expression: Expression; assertedType: string };
const assertion = expr as { type: string; expression: Expression; assertedType: string };
if (assertion.expression) {
indexExpr = assertion.expression;
e = assertion.expression as ExprBase;
Expand Down
7 changes: 6 additions & 1 deletion src/codegen/infrastructure/variable-allocator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1667,7 +1667,12 @@ export class VariableAllocator {
if (!setTypeInfoResult && stmt.value) {
const valueBase = stmt.value as { type: string };
if (valueBase.type === "new") {
const newExpr = stmt.value as { className: string; typeArgs?: string[] };
const newExpr = stmt.value as {
type: string;
className: string;
args: Expression[];
typeArgs?: string[];
};
if (newExpr.className === "Set" && newExpr.typeArgs && newExpr.typeArgs.length > 0) {
setTypeInfoResult = { valueType: newExpr.typeArgs[0] };
}
Expand Down
2 changes: 2 additions & 0 deletions src/codegen/llvm-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ import { JsonObjectMeta } from "./expressions/access/member.js";
import type { TargetInfo } from "../target-types.js";
import { checkClosureMutations } from "../semantic/closure-mutation-checker.js";
import { checkUnionTypes } from "../semantic/union-type-checker.js";
import { checkTypeAssertions } from "../semantic/type-assertion-checker.js";

export interface SemaSymbolData {
names: string[];
Expand Down Expand Up @@ -2351,6 +2352,7 @@ export class LLVMGenerator extends BaseGenerator implements IGeneratorContext {
generateParts(): string[] {
checkClosureMutations(this.ast);
checkUnionTypes(this.ast);
checkTypeAssertions(this.ast);

const irParts: string[] = [];

Expand Down
2 changes: 1 addition & 1 deletion src/parser-native/transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ function handleExpressionStatement(node: TreeSitterNode, ast: AST): void {
const e = expr as ExprBase;

if (e.type === "member_access_assignment" || e.type === "index_access_assignment") {
const memberExprTyped = expr as { type: string; property: string };
const memberExprTyped = expr as { type: string; object: Expression; property: string };
const assignment: AssignmentStatement = {
type: "assignment",
name:
Expand Down
Loading
Loading