Skip to content

Commit

Permalink
Merge pull request #79 from ykmnkmi/workspace
Browse files Browse the repository at this point in the history
Setup workspace.
  • Loading branch information
GZGavinZhao authored Dec 30, 2024
2 parents 8bc3dd5 + eba3b64 commit dd2640c
Show file tree
Hide file tree
Showing 63 changed files with 434 additions and 480 deletions.
362 changes: 181 additions & 181 deletions .github/workflows/dart.yml

Large diffs are not rendered by default.

40 changes: 21 additions & 19 deletions _tests/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,32 @@ description: Tests for AngularDart.
publish_to: none

environment:
sdk: ">=3.1.0 <4.0.0"
sdk: ">=3.6.0 <4.0.0"

resolution: workspace

dependencies:
build: ^2.4.1
build_resolvers: ^2.4.1
build_test: ^2.2.1
collection: ^1.18.0
build_resolvers: ^2.4.2
build_test: ^2.2.2
collection: ^1.19.1
glob: ^2.1.2
js: ^0.6.7
logging: ^1.2.0
ngcompiler: ^3.0.0-dev.2
ngdart: ^8.0.0-dev.3
js: ^0.7.1
logging: ^1.3.0
ngcompiler: ^3.0.0-dev.3
ngdart: ^8.0.0-dev.4
ngtest: ^5.0.0-dev.2
source_gen: ^1.4.0
test: ">=1.24.0 <1.25.0"
source_gen: ^1.5.0
test: ^1.25.9

dev_dependencies:
analyzer: ^6.0.0
build_runner: ^2.4.6
build_web_compilers: ^4.0.4
csslib: ^1.0.0
lints: ^2.1.0
meta: ^1.11.0
mockito: ^5.4.3
package_config: ^2.1.0
source_span: ^1.10.0
analyzer: ^6.5.0
build_runner: ^2.4.12
build_web_compilers: ^4.0.11
csslib: ^1.0.2
lints: ^5.0.0
meta: ^1.16.0
mockito: ^5.4.4
package_config: ^2.1.1
source_span: ^1.10.1
term_glyph: ^1.2.1
10 changes: 0 additions & 10 deletions _tests/pubspec_overrides.yaml

This file was deleted.

10 changes: 6 additions & 4 deletions examples/hello_world/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
name: examples_hello_world

environment:
sdk: ">=3.0.0 <4.0.0"
sdk: ">=3.6.0 <4.0.0"

resolution: workspace

dependencies:
# No strict dependencies, we always use dependency_overrides.
ngdart: ^8.0.0-dev.4

dev_dependencies:
build_runner: ^2.4.6
build_web_compilers: ^4.0.4
lints: ^3.0.0
build_runner: ^2.4.12
build_web_compilers: ^4.0.11
lints: ^5.0.0
8 changes: 0 additions & 8 deletions examples/hello_world/pubspec_overrides.yaml

This file was deleted.

18 changes: 10 additions & 8 deletions goldens/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@ description: Goldens for AngularDart.
publish_to: none

environment:
sdk: ">=3.1.0 <4.0.0"
sdk: ">=3.6.0 <4.0.0"

resolution: workspace

dependencies:
js: ^0.6.7
meta: ^1.11.0
js: ^0.7.1
meta: ^1.16.0
ngdart: ^8.0.0-dev.4

dev_dependencies:
build_runner: ^2.4.6
build_web_compilers: ^4.0.4
dart_style: ^2.3.3
build_runner: ^2.4.12
build_web_compilers: ^4.0.11
dart_style: ^2.3.7
glob: ^2.1.2
lints: ^3.0.0
path: ^1.8.3
lints: ^5.0.0
path: ^1.9.1
8 changes: 0 additions & 8 deletions goldens/pubspec_overrides.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions ngast/lib/src/ast/content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ abstract mixin class EmbeddedContentAst implements StandaloneTemplateAst {
///
/// May be null if and only if decorator 'select' is defined,
/// but no value is assigned.
/// If 'select' is not defined at all (simple <ng-content>), then the value
/// If 'select' is not defined at all (simple `<ng-content>`), then the value
/// will default to '*'.
String? get selector;

Expand All @@ -58,7 +58,7 @@ abstract mixin class EmbeddedContentAst implements StandaloneTemplateAst {
/// Reference assignment.
ReferenceAst? get reference;

/// </ng-content> that is paired to this <ng-content>.
/// `</ng-content>` that is paired to this `<ng-content>`.
CloseElementAst get closeComplement;
set closeComplement(CloseElementAst closeComplement);

Expand Down
2 changes: 0 additions & 2 deletions ngast/lib/src/expression/micro/scanner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ class NgMicroScanner {
return _scanLetAssignment();
case _NgMicroScannerState.scanLetIdentifier:
return _scanLetIdentifier();
default:
throw _unexpected();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of angular_ast.src.recovery_protocol.recovery_protocol;
part of 'recovery_protocol.dart';

class NgAnalyzerRecoveryProtocol extends RecoveryProtocol {
@override
Expand Down
2 changes: 0 additions & 2 deletions ngast/lib/src/recovery_protocol/recovery_protocol.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
library angular_ast.src.recovery_protocol.recovery_protocol;

import '../parser/reader.dart';
import '../scanner.dart';
import '../token/tokens.dart';
Expand Down
4 changes: 2 additions & 2 deletions ngast/lib/src/scanner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1206,8 +1206,8 @@ class NgScanner {
}

/// For consistency purposes:
/// Element `Open` indicates <blah>
/// Element `Close` indicates </blah>
/// Element `Open` indicates `<blah>`
/// Element `Close` indicates `</blah>`
///
/// Start indicates the left bracket (< or </)
/// End indicates the right bracket (> or />)
Expand Down
2 changes: 1 addition & 1 deletion ngast/lib/src/token/lexeme.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of ngast.src.token.tokens;
part of 'tokens.dart';

/// A [NgSimpleToken] that has a custom lexeme, i.e. not predefined by type.
///
Expand Down
2 changes: 1 addition & 1 deletion ngast/lib/src/token/token_types.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of ngast.src.token.tokens;
part of 'tokens.dart';

/// The types of tokens that can be returned by the NgStringTokenizer
enum NgSimpleTokenType {
Expand Down
2 changes: 0 additions & 2 deletions ngast/lib/src/token/tokens.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
library ngast.src.token.tokens;

part 'lexeme.dart';
part 'token_types.dart';

Expand Down
20 changes: 11 additions & 9 deletions ngast/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@ version: 3.0.0-dev.2
repository: https://github.com/angulardart-community/angular

environment:
sdk: ">=3.1.0 <4.0.0"
sdk: ">=3.6.0 <4.0.0"

resolution: workspace

dependencies:
charcode: ^1.3.1
collection: ^1.18.0
meta: ^1.11.0
source_span: ^1.10.0
string_scanner: ^1.2.0
charcode: ^1.4.0
collection: ^1.19.1
meta: ^1.16.0
source_span: ^1.10.1
string_scanner: ^1.4.0

dev_dependencies:
lints: ^2.1.0
path: ^1.8.3
test: ">=1.24.0 <1.25.0"
lints: ^5.0.0
path: ^1.9.1
test: ^1.25.9
4 changes: 0 additions & 4 deletions ngast/test/random_generator_test/random_tester.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ NgSimpleTokenType generateRandomSimple(State state) {
case State.text:
var i = rng.nextInt(textMap.length);
return textMap[i];
default:
return NgSimpleTokenType.unexpectedChar;
}
}

Expand Down Expand Up @@ -144,8 +142,6 @@ String generateHtmlString() {
sb.write('lorem ipsum');
}
break;
default:
sb.write('');
}
}
return sb.toString();
Expand Down
2 changes: 1 addition & 1 deletion ngcompiler/lib/v1/cli.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
///
/// **NOTE**: This is not an externally stable API. Use at your own risk.
@experimental
library angular_compiler.cli;
library;

import 'package:meta/meta.dart';

Expand Down
60 changes: 32 additions & 28 deletions ngcompiler/lib/v1/src/compiler/analyzed_class.dart
Original file line number Diff line number Diff line change
Expand Up @@ -241,36 +241,37 @@ class _TypeResolver extends ast.AstVisitor<DartType, dynamic> {
_implicitReceiverType = classElement.thisType;

@override
DartType visitBinary(ast.Binary ast, _) {
DartType visitBinary(ast.Binary ast, dynamic context) {
// Special case for adding two strings together.
if (ast.operator == '+' &&
ast.left.visit(this, _) == _stringType &&
ast.right.visit(this, _) == _stringType) {
ast.left.visit(this, context) == _stringType &&
ast.right.visit(this, context) == _stringType) {
return _stringType;
}
return _dynamicType;
}

@override
DartType visitConditional(ast.Conditional ast, _) => _dynamicType;
DartType visitConditional(ast.Conditional ast, context) => _dynamicType;

@override
DartType visitEmptyExpr(ast.EmptyExpr ast, _) => _dynamicType;
DartType visitEmptyExpr(ast.EmptyExpr ast, dynamic context) => _dynamicType;

@override
DartType visitFunctionCall(ast.FunctionCall ast, _) => _dynamicType;
DartType visitFunctionCall(ast.FunctionCall ast, dynamic context) =>
_dynamicType;

@override
DartType visitIfNull(ast.IfNull ast, _) => _dynamicType;
DartType visitIfNull(ast.IfNull ast, dynamic context) => _dynamicType;

@override
DartType visitImplicitReceiver(ast.ImplicitReceiver ast, _) =>
DartType visitImplicitReceiver(ast.ImplicitReceiver ast, dynamic context) =>
_implicitReceiverType;

@override
DartType visitInterpolation(ast.Interpolation ast, _) {
DartType visitInterpolation(ast.Interpolation ast, dynamic context) {
if (ast.expressions.length == 1) {
final type = ast.expressions[0].visit(this, _);
final type = ast.expressions[0].visit(this, context);
if (_isPrimitive(type)) {
return type;
}
Expand All @@ -280,36 +281,37 @@ class _TypeResolver extends ast.AstVisitor<DartType, dynamic> {
}

@override
DartType visitKeyedRead(ast.KeyedRead ast, _) => _dynamicType;
DartType visitKeyedRead(ast.KeyedRead ast, dynamic context) => _dynamicType;

@override
DartType visitKeyedWrite(ast.KeyedWrite ast, _) => _dynamicType;
DartType visitKeyedWrite(ast.KeyedWrite ast, dynamic context) => _dynamicType;

@override
DartType visitLiteralPrimitive(ast.LiteralPrimitive ast, _) =>
DartType visitLiteralPrimitive(ast.LiteralPrimitive ast, dynamic context) =>
ast.value is String ? _stringType : _dynamicType;

@override
DartType visitMethodCall(ast.MethodCall ast, _) {
var receiverType = ast.receiver.visit(this, _);
DartType visitMethodCall(ast.MethodCall ast, dynamic context) {
var receiverType = ast.receiver.visit(this, context);
return _lookupMethodReturnType(receiverType, ast.name);
}

@override
DartType visitNamedExpr(ast.NamedExpr ast, _) => _dynamicType;
DartType visitNamedExpr(ast.NamedExpr ast, dynamic context) => _dynamicType;

@override
DartType visitPipe(ast.BindingPipe ast, _) => _dynamicType;
DartType visitPipe(ast.BindingPipe ast, dynamic context) => _dynamicType;

@override
DartType visitPrefixNot(ast.PrefixNot ast, _) => _dynamicType;
DartType visitPrefixNot(ast.PrefixNot ast, dynamic context) => _dynamicType;

@override
DartType visitPostfixNotNull(ast.PostfixNotNull ast, _) => _dynamicType;
DartType visitPostfixNotNull(ast.PostfixNotNull ast, dynamic context) =>
_dynamicType;

@override
DartType visitPropertyRead(ast.PropertyRead ast, _) {
var receiverType = ast.receiver.visit(this, _);
DartType visitPropertyRead(ast.PropertyRead ast, dynamic context) {
var receiverType = ast.receiver.visit(this, context);
if (identical(receiverType, _implicitReceiverType)) {
// This may be a local variable.
for (var variableName in _variables.keys) {
Expand All @@ -322,28 +324,30 @@ class _TypeResolver extends ast.AstVisitor<DartType, dynamic> {
}

@override
DartType visitPropertyWrite(ast.PropertyWrite ast, _) => _dynamicType;
DartType visitPropertyWrite(ast.PropertyWrite ast, dynamic context) =>
_dynamicType;

@override
DartType visitSafeMethodCall(ast.SafeMethodCall ast, _) {
var receiverType = ast.receiver.visit(this, _);
DartType visitSafeMethodCall(ast.SafeMethodCall ast, dynamic context) {
var receiverType = ast.receiver.visit(this, context);
return _lookupMethodReturnType(receiverType, ast.name);
}

@override
DartType visitSafePropertyRead(ast.SafePropertyRead ast, _) {
var receiverType = ast.receiver.visit(this, _);
DartType visitSafePropertyRead(ast.SafePropertyRead ast, dynamic context) {
var receiverType = ast.receiver.visit(this, context);
return _lookupGetterReturnType(receiverType, ast.name);
}

@override
DartType visitStaticRead(ast.StaticRead ast, _) =>
DartType visitStaticRead(ast.StaticRead ast, dynamic context) =>
ast.id.analyzedClass == null
? _dynamicType
: ast.id.analyzedClass!.classElement.thisType;

@override
DartType visitVariableRead(ast.VariableRead ast, _) => _dynamicType;
DartType visitVariableRead(ast.VariableRead ast, dynamic context) =>
_dynamicType;

/// Returns the return type of [getterName] on [receiverType], if it exists.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class AstDirectiveNormalizer {
];
}

/// Parse the template, and visit to find <ng-content>.
/// Parse the template, and visit to find `<ng-content>`.
List<String> _parseTemplate(
String template,
CompileTypeMetadata directiveType,
Expand Down
Loading

0 comments on commit dd2640c

Please sign in to comment.