From c4548ea7b81dfa518d616d95be88f6bae25dfe48 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 20 Nov 2023 13:06:55 +0000 Subject: [PATCH] Some very quick fixes --- .github/workflows/rust.yml | 5 +++++ Cargo.lock | 4 ++-- Cargo.toml | 2 +- checker/Cargo.toml | 2 +- checker/src/behavior/functions.rs | 7 ++++++- checker/src/behavior/operations.rs | 1 - checker/src/synthesis/classes.rs | 7 ++----- checker/src/synthesis/interfaces.rs | 8 +------- checker/src/types/classes.rs | 7 ++++--- parser/Cargo.toml | 2 +- parser/generator/Cargo.toml | 4 ++-- src/js-based-plugin/index.mjs | 4 ++-- src/js-based-plugin/types.d.ts | 2 +- 13 files changed, 28 insertions(+), 27 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 67fe317a..0a65919e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -73,6 +73,11 @@ jobs: run: cargo check -p ezno-parser --no-default-features + - name: Check checker without default features + if: steps.changes.outputs.checker == 'true' + run: + cargo check -p ezno-checker --no-default-features + formating: runs-on: ubuntu-latest steps: diff --git a/Cargo.lock b/Cargo.lock index 1129e9cc..e536f64b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -273,7 +273,7 @@ dependencies = [ [[package]] name = "ezno-ast-generator" -version = "0.0.8" +version = "0.0.9" dependencies = [ "ezno-parser", "pretty_assertions", @@ -308,7 +308,7 @@ dependencies = [ [[package]] name = "ezno-parser" -version = "0.0.8" +version = "0.1.1" dependencies = [ "derive-debug-extras", "derive-enum-from-into", diff --git a/Cargo.toml b/Cargo.toml index a4c7bb81..1bb6de32 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -53,7 +53,7 @@ package = "ezno-checker" [dependencies.parser] path = "./parser" -version = "0.1.0" +version = "0.1.1" features = ["extras"] package = "ezno-parser" diff --git a/checker/Cargo.toml b/checker/Cargo.toml index 7adfb64b..d9c74015 100644 --- a/checker/Cargo.toml +++ b/checker/Cargo.toml @@ -44,6 +44,6 @@ erased-serde = "0.3" [dependencies.parser] path = "../parser" optional = true -version = "0.1.0" +version = "0.1.1" features = ["extras"] package = "ezno-parser" diff --git a/checker/src/behavior/functions.rs b/checker/src/behavior/functions.rs index 6fc68d34..347b0843 100644 --- a/checker/src/behavior/functions.rs +++ b/checker/src/behavior/functions.rs @@ -9,7 +9,6 @@ use crate::{ Context, ContextType, }, events::Event, - synthesis::interfaces::GetterSetter, types::{ classes::ClassValue, functions::SynthesisedParameters, @@ -48,6 +47,12 @@ impl ThisValue { } } +pub enum GetterSetter { + Getter, + Setter, + None, +} + pub fn register_arrow_function( expecting: TypeId, is_async: bool, diff --git a/checker/src/behavior/operations.rs b/checker/src/behavior/operations.rs index 71d8b7e9..bbc79304 100644 --- a/checker/src/behavior/operations.rs +++ b/checker/src/behavior/operations.rs @@ -5,7 +5,6 @@ use source_map::{Span, SpanWithSource}; use crate::{ diagnostics::TypeCheckError, - synthesis::EznoParser, types::{ cast_as_number, cast_as_string, is_type_truthy_falsy, new_logical_or_type, StructureGenerics, TypeStore, diff --git a/checker/src/synthesis/classes.rs b/checker/src/synthesis/classes.rs index 600cb1a5..247b2e43 100644 --- a/checker/src/synthesis/classes.rs +++ b/checker/src/synthesis/classes.rs @@ -9,7 +9,7 @@ use parser::{ use crate::{ behavior::functions::{ - function_to_property, ClassPropertiesToRegister, FunctionRegisterBehavior, + function_to_property, ClassPropertiesToRegister, FunctionRegisterBehavior, GetterSetter, }, context::{ environment, @@ -28,10 +28,7 @@ use crate::{ ASTImplementation, CheckingData, PropertyValue, Scope, Type, TypeId, }; -use super::{ - block::synthesise_block, expressions::synthesise_expression, interfaces::GetterSetter, - EznoParser, -}; +use super::{block::synthesise_block, expressions::synthesise_expression, EznoParser}; /// Doesn't have any metadata yet /// diff --git a/checker/src/synthesis/interfaces.rs b/checker/src/synthesis/interfaces.rs index b6a1b1bc..29d5ae9f 100644 --- a/checker/src/synthesis/interfaces.rs +++ b/checker/src/synthesis/interfaces.rs @@ -4,7 +4,7 @@ use parser::{ }; use crate::{ - behavior::functions::{self, ThisValue}, + behavior::functions::{self, GetterSetter, ThisValue}, context::{ facts::Publicity, Environment, {Context, ContextType}, @@ -51,12 +51,6 @@ pub(crate) trait SynthesiseInterfaceBehavior { fn interface_type(&self) -> Option; } -pub enum GetterSetter { - Getter, - Setter, - None, -} - pub(crate) enum InterfaceValue { Function(FunctionType, GetterSetter), Value(TypeId), diff --git a/checker/src/types/classes.rs b/checker/src/types/classes.rs index 17cfe3ac..6c443250 100644 --- a/checker/src/types/classes.rs +++ b/checker/src/types/classes.rs @@ -1,7 +1,8 @@ use crate::{ - behavior::functions::ClassPropertiesToRegister, context::facts::Publicity, events::Event, - synthesis::interfaces::GetterSetter, ASTImplementation, CheckingData, Environment, - PropertyValue, TypeId, + behavior::functions::{ClassPropertiesToRegister, GetterSetter}, + context::facts::Publicity, + events::Event, + ASTImplementation, CheckingData, Environment, PropertyValue, TypeId, }; use super::properties::PropertyKey; diff --git a/parser/Cargo.toml b/parser/Cargo.toml index 32d6021d..caafdb59 100644 --- a/parser/Cargo.toml +++ b/parser/Cargo.toml @@ -2,7 +2,7 @@ name = "ezno-parser" description = "Parser and AST definitions for Ezno" authors = ["Ben "] -version = "0.1.0" +version = "0.1.1" edition = "2021" license = "MIT" repository = "https://github.com/kaleidawave/ezno" diff --git a/parser/generator/Cargo.toml b/parser/generator/Cargo.toml index 1952d430..b1590d2c 100644 --- a/parser/generator/Cargo.toml +++ b/parser/generator/Cargo.toml @@ -2,7 +2,7 @@ name = "ezno-ast-generator" description = "Quasi-quoted constant compiled TS definitions for Ezno AST" authors = ["Ben "] -version = "0.0.8" +version = "0.0.9" edition = "2021" license = "MIT" repository = "https://github.com/kaleidawave/ezno" @@ -17,7 +17,7 @@ proc-macro = true quote = "1.0" proc-macro2 = "1.0" self-rust-tokenize = "0.3.3" -ezno-parser = { path = "..", version = "0.1.0", features = [ +ezno-parser = { path = "..", version = "0.1.1", features = [ "self-rust-tokenize", ] } diff --git a/src/js-based-plugin/index.mjs b/src/js-based-plugin/index.mjs index 54db0ead..0f496a56 100644 --- a/src/js-based-plugin/index.mjs +++ b/src/js-based-plugin/index.mjs @@ -21,11 +21,11 @@ function emitDiagnostics(on, diagnostics, plugin) { /** @param {import("./types").EznoUnpluginOptions} options */ function plugin(options = {}) { let all_js_ts_files = options.all_js_ts_files ?? false; + const build = options.customBuild ?? ezno_build; + // TODO the other 50 const extensions = ["ts", "tsx", "js", "jsx"]; - const build = options.customBuild ?? ezno_build; - const name = "ezno"; const esbuild = { name, diff --git a/src/js-based-plugin/types.d.ts b/src/js-based-plugin/types.d.ts index eb62afe0..cdfe90f7 100644 --- a/src/js-based-plugin/types.d.ts +++ b/src/js-based-plugin/types.d.ts @@ -2,7 +2,7 @@ export type ReadFromFS = (path: string) => string | null; export interface EznoUnpluginOptions { /** Defaults to only running on .ezno.* files */ - all_js_ts_files: bool, + all_js_ts_files?: bool, customBuild?: (cb: ReadFromFS, entryPath: string, minify: bool) => any } \ No newline at end of file