Skip to content

Commit

Permalink
merge dev to main (zenstackhq#288)
Browse files Browse the repository at this point in the history
  • Loading branch information
ymc9 authored Mar 28, 2023
2 parents 23180ce + 5378d51 commit 1008b0e
Show file tree
Hide file tree
Showing 38 changed files with 1,693 additions and 352 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ env:
DO_NOT_TRACK: '1'

on:
push:
branches: ['dev', 'main', 'canary']
pull_request:
branches: ['dev', 'main', 'canary']

jobs:
build-test:
runs-on: ubuntu-latest
runs-on: buildjet-4vcpu-ubuntu-2204

strategy:
matrix:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zenstack-monorepo",
"version": "1.0.0-alpha.85",
"version": "1.0.0-alpha.87",
"description": "",
"scripts": {
"build": "pnpm -r build",
Expand Down
2 changes: 1 addition & 1 deletion packages/language/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zenstackhq/language",
"version": "1.0.0-alpha.85",
"version": "1.0.0-alpha.87",
"displayName": "ZenStack modeling language compiler",
"description": "ZenStack modeling language compiler",
"homepage": "https://zenstack.dev",
Expand Down
8 changes: 5 additions & 3 deletions packages/language/src/ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export type ResolvedShape = ExpressionType | AbstractDeclaration;
export type ResolvedType = {
decl?: ResolvedShape;
array?: boolean;
nullable?: boolean;
};

export const BinaryExprOperatorPriority: Record<BinaryExpr['operator'], number> = {
Expand All @@ -28,10 +29,11 @@ export const BinaryExprOperatorPriority: Record<BinaryExpr['operator'], number>
'<': 3,
'>=': 3,
'<=': 3,
in: 4,
//CollectionPredicateExpr
'^': 4,
'?': 4,
'!': 4,
'^': 5,
'?': 5,
'!': 5,
};

declare module './generated/ast' {
Expand Down
11 changes: 10 additions & 1 deletion packages/language/src/generated/ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export interface BinaryExpr extends AstNode {
readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | DataSourceField | FieldInitializer | FunctionDecl | GeneratorField | MemberAccessExpr | PluginField | UnaryExpr;
readonly $type: 'BinaryExpr';
left: Expression
operator: '!' | '!=' | '&&' | '<' | '<=' | '==' | '>' | '>=' | '?' | '^' | '||'
operator: '!' | '!=' | '&&' | '<' | '<=' | '==' | '>' | '>=' | '?' | '^' | 'in' | '||'
right: Expression
}

Expand Down Expand Up @@ -318,6 +318,7 @@ export interface FunctionParam extends AstNode {
readonly $container: DataModel | Enum | FunctionDecl;
readonly $type: 'FunctionParam';
name: string
optional: boolean
type: FunctionParamType
}

Expand Down Expand Up @@ -752,6 +753,14 @@ export class ZModelAstReflection extends AbstractAstReflection {
]
};
}
case 'FunctionParam': {
return {
name: 'FunctionParam',
mandatory: [
{ name: 'optional', type: 'boolean' }
]
};
}
case 'FunctionParamType': {
return {
name: 'FunctionParamType',
Expand Down
Loading

0 comments on commit 1008b0e

Please sign in to comment.