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

refactor(semantic): always use SymbolFlags::Function for function id #7479

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Dunqing
Copy link
Member

@Dunqing Dunqing commented Nov 25, 2024

close #7402
related: #7470

The purpose of this PR is to keep the SymbolFlags of the function consistent.

Always use SymbolFlags::Function for the function id symbol, to avoid adding extra logic to find accurate SymbolFlags for the function in transformer. This change adds a fallback redeclaration check for case async function foo() {}; var foo; in SemanticBuilder::check_redeclaraion.

No performance difference here because redeclaration is always rare.

Copy link

graphite-app bot commented Nov 25, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

@github-actions github-actions bot added A-semantic Area - Semantic A-transformer Area - Transformer / Transpiler C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Nov 25, 2024
Copy link
Member Author

Dunqing commented Nov 25, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

codspeed-hq bot commented Nov 25, 2024

CodSpeed Performance Report

Merging #7479 will not alter performance

Comparing 11-26-refactor_semantic_keep_consistent_symbolflags_for_function_id (2fb06c0) with main (6655345)

Summary

✅ 30 untouched benchmarks

@Dunqing Dunqing changed the title refactor(semantic): keep consistent SymbolFlags for function id refactor(semantic): always use SymbolFlags::Function for function id Nov 26, 2024
@Dunqing Dunqing force-pushed the 11-26-refactor_semantic_keep_consistent_symbolflags_for_function_id branch from 93b94c7 to 70d22c4 Compare November 26, 2024 07:46
@github-actions github-actions bot added the A-ast Area - AST label Nov 26, 2024
@Dunqing Dunqing force-pushed the 11-26-refactor_semantic_keep_consistent_symbolflags_for_function_id branch from 70d22c4 to 69e66d3 Compare November 26, 2024 07:54
@github-actions github-actions bot added the A-linter Area - Linter label Nov 26, 2024
@Dunqing Dunqing marked this pull request as ready for review November 26, 2024 07:55
@Dunqing Dunqing requested a review from Boshen as a code owner November 26, 2024 07:55
@Dunqing Dunqing force-pushed the 11-26-refactor_semantic_keep_consistent_symbolflags_for_function_id branch 2 times, most recently from 5acbe14 to f40c689 Compare November 26, 2024 09:43
@Boshen Boshen self-assigned this Nov 27, 2024
@Boshen Boshen force-pushed the 11-26-refactor_semantic_keep_consistent_symbolflags_for_function_id branch 2 times, most recently from 90c06bb to 76d7e62 Compare November 28, 2024 10:53
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Nov 28, 2024
Copy link
Member

Boshen commented Nov 28, 2024

Merge activity

  • Nov 28, 5:54 AM EST: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Nov 29, 12:14 AM EST: Graphite disabled "merge when ready" on this PR due to: a merge conflict with the target branch; resolve the conflict and try again..
  • Nov 29, 12:14 AM EST: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.

@Boshen Boshen force-pushed the 11-26-refactor_semantic_keep_consistent_symbolflags_for_function_id branch 3 times, most recently from cd8ff8c to 24da206 Compare November 28, 2024 11:33
@overlookmotel
Copy link
Contributor

Can we possibly discuss this before merging? Personally, I'm not convinced this is a good idea.

@Boshen Boshen force-pushed the 11-26-refactor_semantic_keep_consistent_symbolflags_for_function_id branch from 24da206 to 2fb06c0 Compare November 28, 2024 13:03
@Boshen Boshen added the needs-discussion Requires a discussion from the core team label Nov 29, 2024
@Boshen Boshen marked this pull request as draft November 29, 2024 10:16
@Boshen
Copy link
Member

Boshen commented Nov 29, 2024

// TODO: Needs a better way to handle the function SymbolFlags in different ModuleKind.
let flags = if self.ctx.source_type.is_module() && ctx.current_scope_flags().is_top() {
SymbolFlags::BlockScopedVariable | SymbolFlags::Function
} else {
SymbolFlags::FunctionScopedVariable
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0-merge Merge with Graphite Merge Queue A-ast Area - AST A-linter Area - Linter A-semantic Area - Semantic A-transformer Area - Transformer / Transpiler C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior needs-discussion Requires a discussion from the core team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants