Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attributes don't have locations #1255

Open
verytactical opened this issue Dec 25, 2024 · 1 comment
Open

Attributes don't have locations #1255

verytactical opened this issue Dec 25, 2024 · 1 comment
Assignees
Labels
scope: ast AST (src/ast/*) scope: parser Implementation of parser (src/grammar)
Milestone

Comments

@verytactical
Copy link
Contributor

Function and constant attributes are represented as strings in AST. In order to emit error that involves an attribute, there is no way to gets its location.

Attributes should be represented as objects.

type AstFooAttribute = {
    kind: 'foo';
    loc: SrcInfo;
}
@anton-trunov anton-trunov added this to the v1.6.0 milestone Dec 25, 2024
@anton-trunov anton-trunov added scope: parser Implementation of parser (src/grammar) scope: ast AST (src/ast/*) labels Dec 25, 2024
@verytactical verytactical self-assigned this Dec 25, 2024
@anton-trunov anton-trunov assigned i582 and unassigned verytactical Jan 20, 2025
@i582
Copy link
Contributor

i582 commented Jan 21, 2025

Looks like we already have locations for attributes 🤔

tact/src/ast/ast.ts

Lines 720 to 752 in a0c8381

export type AstConstantAttributeName = "virtual" | "override" | "abstract";
export type AstConstantAttribute = {
type: AstConstantAttributeName;
loc: SrcInfo;
};
export type AstContractAttribute = {
type: "interface";
name: AstString;
loc: SrcInfo;
};
export type AstFunctionAttributeGet = {
kind: "function_attribute";
type: "get";
methodId: AstExpression | null;
loc: SrcInfo;
};
export type AstFunctionAttributeName =
| "mutates"
| "extends"
| "virtual"
| "abstract"
| "override"
| "inline";
export type AstFunctionAttributeRest = {
kind: "function_attribute";
type: AstFunctionAttributeName;
loc: SrcInfo;
};

Commit (28.12): da4b8d8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: ast AST (src/ast/*) scope: parser Implementation of parser (src/grammar)
Projects
None yet
Development

No branches or pull requests

3 participants