Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 43 additions & 5 deletions web_generator/lib/src/ast/base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ import '../interop_gen/namer.dart';
import 'types.dart';

class GlobalOptions {
static int variardicArgsCount = 4;
static int variadicArgsCount = 4;
static bool shouldEmitJsTypes = false;
static bool redeclareOverrides = true;
}

class Options {}

// TODO(nikeokoronkwo): Remove this once we address isNullable
class DeclarationOptions extends Options {
DeclarationOptions();
bool override;

DeclarationOptions({this.override = false});

TypeOptions toTypeOptions({bool nullable = false}) =>
TypeOptions(nullable: nullable);
Expand All @@ -31,11 +33,11 @@ class TypeOptions extends Options {
class ASTOptions {
bool parameter;
bool emitJSTypes;
int variardicArgsCount;
int variadicArgsCount;

ASTOptions(
{this.parameter = false,
this.variardicArgsCount = 4,
this.variadicArgsCount = 4,
this.emitJSTypes = false});
}

Expand Down Expand Up @@ -74,3 +76,39 @@ abstract class Type extends Node {
@override
Reference emit([covariant TypeOptions? options]);
}

abstract class FieldDeclaration extends NamedDeclaration {
abstract final Type type;
}

abstract class CallableDeclaration extends NamedDeclaration {
abstract final List<ParameterDeclaration> parameters;

abstract final List<GenericType> typeParameters;

abstract final Type returnType;
}

enum DeclScope { private, protected, public }

class ParameterDeclaration {
final String name;

final bool optional;

final Type type;

final bool variadic;

ParameterDeclaration(
{required this.name,
this.optional = false,
required this.type,
this.variadic = false});

Parameter emit([DeclarationOptions? options]) {
return Parameter((p) => p
..name = name
..type = type.emit(TypeOptions(nullable: optional)));
}
}
Loading