Skip to content

Commit

Permalink
Update Cairo (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkaput authored Jan 13, 2025
1 parent 2d6ee1d commit 571266c
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 80 deletions.
58 changes: 29 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 28 additions & 28 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,34 +86,34 @@ test-log = "0.2.16"
# on some of them directly.
# This ensures no duplicate instances of Cairo crates are pulled in by mistake.
[patch.crates-io]
cairo-lang-casm = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-compiler = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-debug = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-defs = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-diagnostics = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-doc = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-eq-solver = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-filesystem = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-formatter = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-lowering = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-parser = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-plugins = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-proc-macros = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-project = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-semantic = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-sierra = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-sierra-ap-change = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-sierra-gas = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-sierra-generator = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-sierra-to-casm = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-sierra-type-size = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-starknet = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-starknet-classes = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-syntax = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-syntax-codegen = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-test-plugin = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-test-utils = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-utils = { git = "https://github.com/starkware-libs/cairo", rev = "7f60dfe" }
cairo-lang-casm = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-compiler = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-debug = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-defs = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-diagnostics = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-doc = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-eq-solver = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-filesystem = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-formatter = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-lowering = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-parser = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-plugins = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-proc-macros = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-project = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-semantic = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-sierra = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-sierra-ap-change = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-sierra-gas = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-sierra-generator = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-sierra-to-casm = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-sierra-type-size = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-starknet = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-starknet-classes = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-syntax = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-syntax-codegen = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-test-plugin = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-test-utils = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }
cairo-lang-utils = { git = "https://github.com/starkware-libs/cairo", rev = "dff35c09bfaa1ae0969c48ce4e103bad46d5fe50" }

# The profile used for CI in pull requests.
# External dependencies are built with optimisation enabled,
Expand Down
8 changes: 2 additions & 6 deletions src/lang/db/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use cairo_lang_filesystem::span::TextPosition;
use cairo_lang_parser::db::ParserGroup;
use cairo_lang_syntax::node::ast::TerminalIdentifier;
use cairo_lang_syntax::node::kind::SyntaxKind;
use cairo_lang_syntax::node::{SyntaxNode, TypedSyntaxNode};
use cairo_lang_syntax::node::{SyntaxNode, Terminal};
use cairo_lang_utils::Upcast;

// TODO(mkaput): Make this a real Salsa query group with sensible LRU.
Expand Down Expand Up @@ -38,11 +38,7 @@ pub trait LsSyntaxGroup: Upcast<dyn ParserGroup> {

let find = |position: TextPosition| {
let node = self.find_syntax_node_at_position(file, position)?;
if node.kind(syntax_db) == SyntaxKind::TokenIdentifier {
Some(TerminalIdentifier::from_syntax_node(syntax_db, node.parent()?))
} else {
None
}
TerminalIdentifier::cast_token(syntax_db, node)
};

find(position).or_else(|| {
Expand Down
10 changes: 2 additions & 8 deletions src/lang/proc_macros/plugins/scarb/inline.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use cairo_lang_defs::plugin::{InlinePluginResult, PluginGeneratedFile};
use cairo_lang_filesystem::ids::{CodeMapping, CodeOrigin};
use cairo_lang_filesystem::span::{TextOffset, TextSpan, TextWidth};
use cairo_lang_filesystem::span::TextSpan;
use cairo_lang_macro::TokenStream;
use cairo_lang_syntax::node::{TypedStablePtr, TypedSyntaxNode, ast};
use scarb_proc_macro_server_types::methods::expand::ExpandInlineMacroParams;
Expand Down Expand Up @@ -34,13 +34,7 @@ pub fn inline_macro_generate_code(
InlinePluginResult {
code: Some(PluginGeneratedFile {
name: "inline_proc_macro".into(),
code_mappings: vec![CodeMapping {
origin,
span: TextSpan {
start: TextOffset::default(),
end: TextOffset::default().add_width(TextWidth::from_str(&content)),
},
}],
code_mappings: vec![CodeMapping { origin, span: TextSpan::from_str(&content) }],
content,
aux_data: None,
diagnostics_note: Default::default(),
Expand Down
Loading

0 comments on commit 571266c

Please sign in to comment.