Skip to content

Commit

Permalink
Merge branch 'main' into macros
Browse files Browse the repository at this point in the history
  • Loading branch information
MaryaBelanger committed May 10, 2024
2 parents dac16b3 + e9dfca4 commit 9d749c6
Show file tree
Hide file tree
Showing 74 changed files with 1,155 additions and 1,252 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@df5a14dc28094dc936e103b37d749c6628682b60
uses: github/codeql-action/init@ccf74c947955fd1cf117aef6a0e4e66191ef6f61
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -44,7 +44,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@df5a14dc28094dc936e103b37d749c6628682b60
uses: github/codeql-action/autobuild@ccf74c947955fd1cf117aef6a0e4e66191ef6f61

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -58,4 +58,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@df5a14dc28094dc936e103b37d749c6628682b60
uses: github/codeql-action/analyze@ccf74c947955fd1cf117aef6a0e4e66191ef6f61
8 changes: 4 additions & 4 deletions .github/workflows/scorecards-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ jobs:

steps:
- name: "Checkout code"
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
with:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736
uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534
with:
results_file: results.sarif
results_format: sarif
Expand All @@ -41,14 +41,14 @@ jobs:

# Upload the results as artifacts (optional).
- name: "Upload artifact"
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
with:
name: SARIF file
path: results.sarif
retention-days: 5

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@df5a14dc28094dc936e103b37d749c6628682b60
uses: github/codeql-action/upload-sarif@ccf74c947955fd1cf117aef6a0e4e66191ef6f61
with:
sarif_file: results.sarif
14 changes: 6 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
experimental: false
continue-on-error: ${{ matrix.experimental }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
with:
submodules: recursive
- uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30
Expand All @@ -56,7 +56,7 @@ jobs:
name: Check if code excerpts are up to date
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
with:
submodules: recursive
- uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30
Expand All @@ -71,17 +71,15 @@ jobs:
name: Build site and check links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
with:
submodules: recursive
- uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30
with:
sdk: stable
- name: Fetch Dart packages
run: dart pub get
- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d
with:
version: 8
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
with:
node-version: ${{ env.NODE_VERSION }}
Expand All @@ -99,7 +97,7 @@ jobs:
name: Check if text can be replaced with site variables
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
with:
submodules: recursive
- uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30
Expand All @@ -114,7 +112,7 @@ jobs:
name: Validate Firebase configuration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
with:
submodules: recursive
- uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30
Expand Down
68 changes: 66 additions & 2 deletions examples/misc/lib/language_tour/classes/point_alt.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
///
// #docregion idiomatic-constructor
class Point {
double x = 0;
double y = 0;
// Initializer list of variables and values
double x = 2.0;
double y = 2.0;

// Generative constructor with initializing formal parameters:
Point(this.x, this.y);
Expand All @@ -34,3 +35,66 @@ class Point {
// #docregion idiomatic-constructor
}
// #enddocregion idiomatic-constructor

// #docregion initialize-declaration
class PointA {
double x = 1.0;
double y = 2.0;

// The implicit default constructor sets these variables to (1.0,2.0)
// PointA();

@override
String toString() {
return 'PointA($x,$y)';
}
}
// #enddocregion initialize-declaration

// #docregion initialize-formal
class PointB {
final double x;
final double y;

// Sets the x and y instance variables
// before the constructor body runs.
PointB(this.x, this.y);

// Initializing formal parameters can also be optional.
PointB.optional([this.x = 0.0, this.y = 0.0]);
}
// #enddocregion initialize-formal

// #docregion initialize-named
class PointC {
double x; // must be set in constructor
double y; // must be set in constructor

// Generative constructor with initializing formal parameters
// with default values
PointC.named({this.x = 1.0, this.y = 1.0});

@override
String toString() {
return 'PointC.named($x,$y)';
}
}

// Constructor using named variables.
final pointC = PointC.named(x: 2.0, y: 2.0);
// #enddocregion initialize-named

// #docregion initialize-null
class PointD {
double? x; // null if not set in constructor
double? y; // null if not set in constructor

// Generative constructor with initializing formal parameters
PointD(this.x, this.y);

@override
String toString() {
return 'PointD($x,$y)';
}
}
// #enddocregion initialize-null
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// #docregion named
class Vector2d {
// #enddocregion named
final double x;
final double y;

Vector2d(this.x, this.y);
// #docregion named
// ...
Vector2d.named({required this.x, required this.y});
}

class Vector3d extends Vector2d {
final double z;

// Forward the y parameter to the named super constructor like:
// Vector3d.yzPlane({required double y, required this.z})
// : super.named(x: 0, y: y);
Vector3d.yzPlane({required super.y, required this.z}) : super.named(x: 0);
}
// #enddocregion named
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// #docregion positional
class Vector2d {
final double x;
final double y;

Vector2d(this.x, this.y);
}

class Vector3d extends Vector2d {
final double z;

// Forward the x and y parameters to the default super constructor like:
// Vector3d(final double x, final double y, this.z) : super(x, y);
Vector3d(super.x, super.y, this.z);
}
// #enddocregion positional
26 changes: 19 additions & 7 deletions firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,21 @@
{ "source": "/articles/api-naming-guide{,/**}", "destination": "/effective-dart/design", "type": 301 },
{ "source": "/articles/archive/dart-2", "destination": "/guides/language/evolution#dart-20", "type": 301 },
{ "source": "/articles/archive/event-loop", "destination": "https://medium.com/dartlang/dart-asynchronous-programming-isolates-and-event-loops-bffc3e296a6a", "type": 301 },
{ "source": "/articles/archive/numeric-computation", "destination": "/guides/language/numbers", "type": 301 },
{ "source": "/articles/await-async", "destination": "/codelabs/async-await", "type": 301 },
{ "source": "/articles/broadcast-streams", "destination": "https://medium.com/dartlang/dart-asynchronous-programming-streams-dab952023ed7", "type": 301 },
{ "source": "/articles/converters-and-codecs", "destination": "/articles/archive/converters-and-codecs", "type": 301 },
{ "source": "/articles/creating-streams", "destination": "/articles/libraries/creating-streams", "type": 301 },
{ "source": "/articles/creating-streams", "destination": "/libraries/async/creating-streams", "type": 301 },
{ "source": "/articles/dart-unit-tests{,/**}", "destination": "https://pub.dev/packages/test#writing-tests", "type": 301 },
{ "source": "/articles/dart-vm/io", "destination": "/articles/libraries/dart-io", "type": 301 },
{ "source": "/articles/dart-vm/native-extensions", "destination": "/server/c-interop-native-extensions", "type": 301 },
{ "source": "/articles/dart-vm/numeric-computation", "destination": "/articles/archive/numeric-computation", "type": 301 },
{ "source": "/articles/dart-vm/numeric-computation", "destination": "/guides/language/numbers", "type": 301 },
{ "source": "/articles/dart-vm/snapshots", "destination": "https://github.com/dart-lang/sdk/wiki/Snapshots", "type": 301 },
{ "source": "/articles/design-decisions/why-dart-types", "destination": "/resources/faq#types", "type": 301 },
{ "source": "/articles/doc-comment-guidelines", "destination": "/effective-dart/documentation", "type": 301 },
{ "source": "/articles/event-loop", "destination": "https://medium.com/dartlang/dart-asynchronous-programming-isolates-and-event-loops-bffc3e296a6a", "type": 301 },
{ "source": "/articles/feet-wet-streams{,/**}", "destination": "/tutorials/language/streams", "type": 301 },
{ "source": "/articles/futures-and-error-handling", "destination": "/guides/libraries/futures-error-handling", "type": 301 },
{ "source": "/articles/feet-wet-streams{,/**}", "destination": "/libraries/async/using-streams", "type": 301 },
{ "source": "/articles/futures-and-error-handling", "destination": "/libraries/async/futures-error-handling", "type": 301 },
{ "source": "/articles/idiomatic-dart{,/**}", "destination": "/effective-dart", "type": 301 },
{ "source": "/articles/io", "destination": "/articles/libraries/dart-io", "type": 301 },
{ "source": "/articles/js-dart-interop", "destination": "/web/libraries#js-interop", "type": 301 },
Expand All @@ -58,13 +59,15 @@
{ "source": "/articles/language/optional-types", "destination": "/resources/faq#types", "type": 301 },
{ "source": "/articles/libraries", "destination": "/libraries", "type": 301 },
{ "source": "/articles/libraries/converters-and-codecs", "destination": "/articles/archive/converters-and-codecs", "type": 301 },
{ "source": "/articles/libraries/creating-streams", "destination": "/libraries/async/creating-streams", "type": 301 },
{ "source": "/articles/libraries/dart-io", "destination": "/libraries/dart-io", "type": 301 },
{ "source": "/articles/libraries/zones", "destination": "/articles/archive/zones", "type": 301 },
{ "source": "/articles/libraries*{,/**}", "destination": "/libraries", "type": 301 },
{ "source": "/articles/m*{,/**}", "destination": "/guides/language/evolution", "type": 301 },
{ "source": "/articles/mixins", "destination": "/language/mixins", "type": 301 },
{ "source": "/articles/mocking-with-dart", "destination": "https://pub.dev/packages/mockito", "type": 301 },
{ "source": "/articles/native-extensions-for-standalone-dart-vm", "destination": "/server/c-interop-native-extensions", "type": 301 },
{ "source": "/articles/numeric-computation", "destination": "/articles/archive/numeric-computation", "type": 301 },
{ "source": "/articles/numeric-computation", "destination": "/guides/language/numbers", "type": 301 },
{ "source": "/articles/optional-types", "destination": "/resources/faq#types", "type": 301 },
{ "source": "/articles/serialization", "destination": "/guides/json", "type": 301 },
{ "source": "/articles/server/native-extensions", "destination": "/server/c-interop-native-extensions", "type": 301 },
Expand Down Expand Up @@ -132,7 +135,7 @@
{ "source": "/docs/tutorials/indexeddb{,/**}", "destination": "https://api.dart.dev/stable/dart-indexed_db/dart-indexed_db-library.html", "type": 301 },
{ "source": "/docs/tutorials/remove-elements", "destination": "/library/dart-html", "type": 301 },
{ "source": "/docs/tutorials/shared-pkgs", "destination": "/guides/packages", "type": 301 },
{ "source": "/docs/tutorials/streams", "destination": "/tutorials/language/streams", "type": 301 },
{ "source": "/docs/tutorials/streams", "destination": "/libraries/async/using-streams", "type": 301 },
{ "source": "/docs/tutorials{,/**}", "destination": "/tutorials", "type": 301 },
{ "source": "/docs{,/**}", "destination": "/guides", "type": 301 },
{ "source": "/downloads{,.html,/**}", "destination": "/get-dart", "type": 301 },
Expand All @@ -149,6 +152,7 @@
{ "source": "/go/analysis-server-protocol", "destination": "https://htmlpreview.github.io/?https://github.com/dart-lang/sdk/blob/main/pkg/analysis_server/doc/api.html", "type": 301 },
{ "source": "/go/automated-publishing", "destination": "/tools/pub/automated-publishing", "type": 301 },
{ "source": "/go/cloud", "destination": "/server/google-cloud?utm_source=go-link&utm_medium=referral&utm_campaign=go-cloud", "type": 301 },
{ "source": "/go/json-codable", "destination": "https://github.com/dart-lang/sdk/tree/main/pkg/json", "type": 301 },
{ "source": "/go/content-hashes", "destination": "/tools/pub/glossary#content-hashes", "type": 301 },
{ "source": "/go/core-lints", "destination": "https://github.com/dart-lang/lints", "type": 301 },
{ "source": "/go/dart-fix", "destination": "/tools/dart-fix", "type": 301 },
Expand Down Expand Up @@ -192,8 +196,11 @@

{ "source": "/googleapis", "destination": "https://github.com/dart-lang/googleapis", "type": 301 },
{ "source": "/guides/get-started", "destination": "/overview", "type": 301 },
{ "source": "/guides/google-apis", "destination": "/resources/google-apis", "type": 301 },
{ "source": "/guides/language/analysis-options", "destination": "/tools/analysis", "type": 301 },
{ "source": "/guides/language/cheatsheet", "destination": "/language", "type": 301 },
{ "source": "/guides/language/coming-from/js-to-dart", "destination": "/resources/coming-from/js-to-dart", "type": 301 },
{ "source": "/guides/language/coming-from/swift-to-dart", "destination": "/resources/coming-from/swift-to-dart", "type": 301 },
{ "source": "/guides/language/common-prob", "destination": "/guides/language/sound-problems", "type": 301 },
{ "source": "/guides/language/concurrency", "destination": "/language/concurrency", "type": 301 },
{ "source": "/guides/language/effective-dart", "destination": "/effective-dart", "type": 301 },
Expand All @@ -207,9 +214,12 @@
{ "source": "/guides/language/type-system", "destination": "/language/type-system", "type": 301 },
{ "source": "/guides/libraries", "destination": "/libraries", "type": 301 },
{ "source": "/guides/libraries/create-library-packages", "destination": "/guides/libraries/create-packages", "type": 301 },
{ "source": "/guides/libraries/futures-error-handling", "destination": "/libraries/async/futures-error-handling", "type": 301 },
{ "source": "/guides/libraries/java-interop", "destination": "/interop/java-interop", "type": 301 },
{ "source": "/guides/libraries/objective-c-interop", "destination": "/interop/objective-c-interop", "type": 301 },
{ "source": "/guides/libraries/c-interop", "destination": "/interop/c-interop", "type": 301 },
{ "source": "/guides/libraries/c-interop", "destination": "/interop/c-interop", "type": 301 },
{ "source": "/guides/libraries/writing-package-pages", "destination": "/tools/pub/writing-package-pages", "type": 301 },
{ "source": "/guides/libraries/useful-libraries", "destination": "/resources/useful-packages", "type": 301 },
{ "source": "/guides/platforms", "destination": "/overview#platform", "type": 301 },
{ "source": "/install", "destination": "/get-dart", "type": 301 },
{ "source": "/install/**", "destination": "/get-dart", "type": 301 },
Expand Down Expand Up @@ -295,7 +305,9 @@
{ "source": "/tos@(|.htm|.html)", "destination": "/terms", "type": 301 },
{ "source": "/tutorials/dart-vm", "destination": "/tutorials/server", "type": 301 },
{ "source": "/tutorials/dart-vm/:page*", "destination": "/tutorials/server/:page*", "type": 301 },
{ "source": "/tutorials/language", "destination": "/language", "type": 301 },
{ "source": "/tutorials/language/futures", "destination": "/codelabs/async-await", "type": 301 },
{ "source": "/tutorials/language/streams", "destination": "/libraries/async/using-streams", "type": 301 },
{ "source": "/tutorials/libraries", "destination": "/libraries", "type": 301 },
{ "source": "/tutorials/libraries/shared-pkgs", "destination": "/guides/packages", "type": 301 },
{ "source": "/tutorials/web", "destination": "/web/get-started", "type": 301 },
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
"node": ">=20.10.0",
"pnpm": ">=8.14.0"
},
"packageManager": "pnpm@8.15.6",
"packageManager": "pnpm@8.15.8",
"dependencies": {
"bootstrap-scss": "^4.6.2"
},
"devDependencies": {
"@11ty/eleventy": "3.0.0-alpha.6",
"firebase-tools": "^13.7.2",
"@11ty/eleventy": "3.0.0-alpha.10",
"firebase-tools": "^13.8.2",
"hast-util-from-html": "^2.0.1",
"hast-util-select": "^6.0.2",
"hast-util-to-text": "^4.0.2",
Expand All @@ -35,7 +35,7 @@
"markdown-it-container": "^4.0.0",
"markdown-it-deflist": "^3.0.0",
"markdown-it-table": "^4.1.1",
"sass": "^1.75.0",
"shiki": "^1.3.0"
"sass": "^1.77.0",
"shiki": "^1.5.1"
}
}

0 comments on commit 9d749c6

Please sign in to comment.