From a0c6a33cd45b2467ffd39e7d6a7b28a08b83895d Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Mon, 14 Nov 2016 16:59:44 -0800 Subject: [PATCH] Various changes to close a bunch of open issues (#21) * Various changes. * Update presubmit. --- analysis_options.yaml => .analysis_options | 19 +-- CHANGELOG.md | 9 ++ lib/code_builder.dart | 5 +- lib/dart/async.dart | 6 + lib/dart/core.dart | 5 + lib/src/builders/expression.dart | 153 +++++++++++++++++--- lib/src/builders/expression/assert.dart | 4 + lib/src/builders/expression/assign.dart | 4 + lib/src/builders/expression/invocation.dart | 4 + lib/src/builders/expression/negate.dart | 4 + lib/src/builders/expression/operators.dart | 4 + lib/src/builders/expression/return.dart | 4 + lib/src/builders/field.dart | 4 + lib/src/builders/file.dart | 103 ++++++++++++- lib/src/builders/statement/block.dart | 4 + lib/src/builders/statement/if.dart | 4 + lib/src/builders/type/new_instance.dart | 4 + lib/src/tokens.dart | 9 ++ test/builders/expression_test.dart | 23 +++ test/builders/field_test.dart | 4 + test/builders/file_test.dart | 62 ++++++++ test/builders/reference_test.dart | 9 -- test/builders/shared_test.dart | 4 + test/builders/statement_test.dart | 4 + test/builders/type_test.dart | 4 + test/scope_test.dart | 4 + tool/presubmit.sh | 2 +- 27 files changed, 416 insertions(+), 49 deletions(-) rename analysis_options.yaml => .analysis_options (67%) create mode 100644 test/builders/file_test.dart delete mode 100644 test/builders/reference_test.dart diff --git a/analysis_options.yaml b/.analysis_options similarity index 67% rename from analysis_options.yaml rename to .analysis_options index b256a69..6f04432 100644 --- a/analysis_options.yaml +++ b/.analysis_options @@ -2,32 +2,27 @@ analyzer: strong-mode: true linter: rules: + # Errors - avoid_empty_else - - comment_references - control_flow_in_finally - empty_statements - - hash_and_equals - - iterable_contains_unrelated_type - - list_remove_unrelated_type - test_types_in_equals - throw_in_finally - - unrelated_type_equality_checks - valid_regexps - - always_declare_return_types + + # Style - annotate_overrides - avoid_init_to_null - avoid_return_types_on_setters - await_only_futures - camel_case_types - - constant_identifier_names + - comment_references - empty_catches - empty_constructor_bodies - - library_names + - hash_and_equals - library_prefixes - - only_throw_errors - - overridden_fields - - package_prefixed_library_names + - non_constant_identifier_names - prefer_is_not_empty - slash_for_doc_comments - type_init_formals - - unnecessary_getters_setters + - unrelated_type_equality_checks diff --git a/CHANGELOG.md b/CHANGELOG.md index ffc86f3..c2ed69b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 1.0.0-alpha+1 + +- Slight updates to confusing documentation. +- Added support for null-aware assignments. +- Added `show` and `hide` support to `ImportBuilder` +- Added `deferred` support to `ImportBuilder` +- Added `ExportBuilder` +- Added `list` and `map` literals that support generic types + ## 1.0.0-alpha - Large refactor that makes the library more feature complete. diff --git a/lib/code_builder.dart b/lib/code_builder.dart index 9506468..abc1430 100644 --- a/lib/code_builder.dart +++ b/lib/code_builder.dart @@ -6,10 +6,11 @@ export 'src/builders/annotation.dart' show AnnotationBuilder; export 'src/builders/class.dart' show asStatic, clazz, extend, implement, mixin, ClassBuilder; export 'src/builders/expression.dart' - show literal, ExpressionBuilder, InvocationBuilder; + show literal, list, map, ExpressionBuilder, InvocationBuilder; export 'src/builders/field.dart' show varConst, varField, varFinal, FieldBuilder; -export 'src/builders/file.dart' show ImportBuilder, LibraryBuilder, PartBuilder; +export 'src/builders/file.dart' + show ExportBuilder, ImportBuilder, LibraryBuilder, PartBuilder; export 'src/builders/method.dart' show constructor, diff --git a/lib/dart/async.dart b/lib/dart/async.dart index 6025c39..68d0b27 100644 --- a/lib/dart/async.dart +++ b/lib/dart/async.dart @@ -35,6 +35,12 @@ class DartAsync { /// References [dart_async.Future]. final ReferenceBuilder Future = _ref('Future'); + /// References [dart_async.Stream]. + final ReferenceBuilder Stream = _ref('Stream'); + + /// References [dart_async.StreamSubscription]. + final ReferenceBuilder StreamSubscription = _ref('StreamSubscription'); + DartAsync._(); static ReferenceBuilder _ref(String name) => reference(name, 'dart:async'); diff --git a/lib/dart/core.dart b/lib/dart/core.dart index 9a5a0d7..fbbe89f 100644 --- a/lib/dart/core.dart +++ b/lib/dart/core.dart @@ -213,6 +213,11 @@ class DartCore { /// References [dart_core.UriData]. final ReferenceBuilder UriData = _ref('UriData'); + /// References `dynamic` type for returning any in a method. + /// + /// **NOTE**: As a language limitation, this cannot be named `dynamic`. + final TypeBuilder $dynamic = new TypeBuilder('dynamic'); + /// References `void` type for returning nothing in a method. /// /// **NOTE**: As a language limitation, this cannot be named `void`. diff --git a/lib/src/builders/expression.dart b/lib/src/builders/expression.dart index faa78c7..4bd6439 100644 --- a/lib/src/builders/expression.dart +++ b/lib/src/builders/expression.dart @@ -1,8 +1,7 @@ -library code_builder.src.builders.expression; - // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +library code_builder.src.builders.expression; import 'package:analyzer/analyzer.dart'; import 'package:analyzer/dart/ast/token.dart'; @@ -32,7 +31,37 @@ final _true = new BooleanLiteral(new KeywordToken(Keyword.TRUE, 0), true); /// Returns a pre-defined literal expression of [value]. /// /// Only primitive values are allowed. -ExpressionBuilder literal(value) => new _LiteralExpression(_literal(value)); +ExpressionBuilder literal(value) { + if (value is List) { + return list(value); + } + if (value is Map) { + return map(value); + } + return new _LiteralExpression(_literal(value)); +} + +/// Returns a literal `List` expression from [values]. +/// +/// Optionally specify [asConst] or with a generic [type]. +ExpressionBuilder list( + Iterable values, { + bool asConst: false, + TypeBuilder type, +}) => + new _TypedListExpression(values, asConst: asConst, type: type); + +/// Returns a literal `Map` expression from [values]. +/// +/// Optionally specify [asConst] or with a generic [keyType] or [valueType]. +ExpressionBuilder map( + Map values, { + bool asConst: false, + TypeBuilder keyType, + TypeBuilder valueType, +}) => + new _TypedMapExpression(values, + asConst: asConst, keyType: keyType, valueType: valueType); Literal _literal(value) { if (value == null) { @@ -45,24 +74,6 @@ Literal _literal(value) { return new IntegerLiteral(stringToken('$value'), value); } else if (value is double) { return new DoubleLiteral(stringToken('$value'), value); - } else if (value is List) { - return new ListLiteral( - null, - null, - $openBracket, - value.map/**/(_literal).toList(), - $closeBracket, - ); - } else if (value is Map) { - return new MapLiteral( - null, - null, - $openBracket, - value.keys.map/**/((k) { - return new MapLiteralEntry(_literal(k), $colon, _literal(value[k])); - }).toList(), - $closeBracket, - ); } throw new ArgumentError.value(value, 'Unsupported'); } @@ -357,3 +368,103 @@ class _ParenthesesExpression extends Object with AbstractExpressionMixin { ); } } + +ExpressionBuilder _expressionify(v) { + if (v == null || v is bool || v is String || v is int || v is double) { + return new _LiteralExpression(_literal(v)); + } + if (v is ExpressionBuilder) { + return v; + } + throw new ArgumentError('Could not expressionify $v'); +} + +class _TypedListExpression extends Object with AbstractExpressionMixin { + static List _toExpression(Iterable values) { + return values.map(_expressionify).toList(); + } + + final bool _asConst; + final TypeBuilder _type; + final List _values; + + _TypedListExpression(Iterable values, {bool asConst, TypeBuilder type}) + : _values = _toExpression(values), + _asConst = asConst, + _type = type; + + @override + AstNode buildAst([Scope scope]) => buildExpression(scope); + + @override + Expression buildExpression([Scope scope]) { + return new ListLiteral( + _asConst ? $const : null, + _type != null + ? new TypeArgumentList( + $openBracket, + [_type.buildType(scope)], + $closeBracket, + ) + : null, + $openBracket, + _values.map((v) => v.buildExpression(scope)).toList(), + $closeBracket, + ); + } +} + +class _TypedMapExpression extends Object with AbstractExpressionMixin { + static Map _toExpression(Map values) { + return new Map.fromIterable( + values.keys, + key: (k) => _expressionify(k), + value: (k) => _expressionify(values[k]), + ); + } + + final bool _asConst; + final TypeBuilder _keyType; + final TypeBuilder _valueType; + final Map _values; + + _TypedMapExpression(Map values, + {bool asConst, TypeBuilder keyType, TypeBuilder valueType}) + : _values = _toExpression(values), + _asConst = asConst, + _keyType = keyType != null + ? keyType + : valueType != null ? lib$core.$dynamic : null, + _valueType = valueType != null + ? valueType + : keyType != null ? lib$core.$dynamic : null; + + @override + AstNode buildAst([Scope scope]) => buildExpression(scope); + + @override + Expression buildExpression([Scope scope]) { + return new MapLiteral( + _asConst ? $const : null, + _keyType != null + ? new TypeArgumentList( + $openBracket, + [ + _keyType.buildType(scope), + _valueType.buildType(scope), + ], + $closeBracket, + ) + : null, + $openBracket, + _values.keys.map((k) { + return new MapLiteralEntry( + k.buildExpression(scope), + $colon, + _values[k].buildExpression(scope), + ); + }).toList(), + $closeBracket, + ); + } +} diff --git a/lib/src/builders/expression/assert.dart b/lib/src/builders/expression/assert.dart index 3313fee..3030235 100644 --- a/lib/src/builders/expression/assert.dart +++ b/lib/src/builders/expression/assert.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + part of code_builder.src.builders.expression; class _AsAssert implements StatementBuilder { diff --git a/lib/src/builders/expression/assign.dart b/lib/src/builders/expression/assign.dart index 5c6b191..00bf017 100644 --- a/lib/src/builders/expression/assign.dart +++ b/lib/src/builders/expression/assign.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + part of code_builder.src.builders.expression; class _AsAssign extends AbstractExpressionMixin { diff --git a/lib/src/builders/expression/invocation.dart b/lib/src/builders/expression/invocation.dart index 1c015e6..cef1e32 100644 --- a/lib/src/builders/expression/invocation.dart +++ b/lib/src/builders/expression/invocation.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + part of code_builder.src.builders.expression; /// Partial implementation of [InvocationBuilder]. diff --git a/lib/src/builders/expression/negate.dart b/lib/src/builders/expression/negate.dart index d1d58d3..e5fa834 100644 --- a/lib/src/builders/expression/negate.dart +++ b/lib/src/builders/expression/negate.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + part of code_builder.src.builders.expression; class _NegateExpression extends AbstractExpressionMixin { diff --git a/lib/src/builders/expression/operators.dart b/lib/src/builders/expression/operators.dart index f36140a..cebc852 100644 --- a/lib/src/builders/expression/operators.dart +++ b/lib/src/builders/expression/operators.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + part of code_builder.src.builders.expression; class _AsBinaryExpression extends Object with AbstractExpressionMixin { diff --git a/lib/src/builders/expression/return.dart b/lib/src/builders/expression/return.dart index d57c7de..0778b0f 100644 --- a/lib/src/builders/expression/return.dart +++ b/lib/src/builders/expression/return.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + part of code_builder.src.builders.expression; class _AsReturn implements StatementBuilder { diff --git a/lib/src/builders/field.dart b/lib/src/builders/field.dart index 51b5d97..16e10fc 100644 --- a/lib/src/builders/field.dart +++ b/lib/src/builders/field.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + import 'package:analyzer/analyzer.dart'; import 'package:analyzer/dart/ast/token.dart'; import 'package:analyzer/src/dart/ast/token.dart'; diff --git a/lib/src/builders/file.dart b/lib/src/builders/file.dart index fc6e71b..ce580f4 100644 --- a/lib/src/builders/file.dart +++ b/lib/src/builders/file.dart @@ -131,25 +131,120 @@ class _LibraryDirectiveBuilder implements AstBuilder { class ImportBuilder implements AstBuilder { final String _prefix; final String _uri; + final bool _deferred; - factory ImportBuilder(String path, {String prefix}) { - return new ImportBuilder._(path, prefix); + final Set _show = new Set(); + final Set _hide = new Set(); + + factory ImportBuilder(String path, {bool deferred: false, String prefix}) { + return new ImportBuilder._(path, prefix, deferred); + } + + ImportBuilder._(this._uri, this._prefix, this._deferred); + + void hide(String identifier) { + _hide.add(identifier); } - ImportBuilder._(this._uri, this._prefix); + void hideAll(Iterable identifiers) { + _hide.addAll(identifiers); + } + + void show(String identifier) { + _show.add(identifier); + } + + void showAll(Iterable identifier) { + _show.addAll(identifier); + } @override ImportDirective buildAst([_]) { + var combinators = []; + if (_show.isNotEmpty) { + combinators.add( + new ShowCombinator( + $show, + _show.map(stringIdentifier).toList(), + ), + ); + } + if (_hide.isNotEmpty) { + combinators.add( + new HideCombinator( + $hide, + _hide.map(stringIdentifier).toList(), + ), + ); + } return new ImportDirective( null, null, null, new SimpleStringLiteral(stringToken("'$_uri'"), _uri), null, - null, + _deferred ? $deferred : null, _prefix != null ? $as : null, _prefix != null ? stringIdentifier(_prefix) : null, + combinators, + $semicolon, + ); + } +} + +/// Lazily builds an [ExportDirective] AST when built. +class ExportBuilder implements AstBuilder { + final String _uri; + + final Set _show = new Set(); + final Set _hide = new Set(); + + factory ExportBuilder(String path) = ExportBuilder._; + + ExportBuilder._(this._uri); + + void hide(String identifier) { + _hide.add(identifier); + } + + void hideAll(Iterable identifiers) { + _hide.addAll(identifiers); + } + + void show(String identifier) { + _show.add(identifier); + } + + void showAll(Iterable identifier) { + _show.addAll(identifier); + } + + @override + ExportDirective buildAst([_]) { + var combinators = []; + if (_show.isNotEmpty) { + combinators.add( + new ShowCombinator( + $show, + _show.map(stringIdentifier).toList(), + ), + ); + } + if (_hide.isNotEmpty) { + combinators.add( + new HideCombinator( + $hide, + _hide.map(stringIdentifier).toList(), + ), + ); + } + return new ExportDirective( + null, + null, + null, + new SimpleStringLiteral(stringToken("'$_uri'"), _uri), null, + combinators, $semicolon, ); } diff --git a/lib/src/builders/statement/block.dart b/lib/src/builders/statement/block.dart index 57ef9eb..f3f8e69 100644 --- a/lib/src/builders/statement/block.dart +++ b/lib/src/builders/statement/block.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + import 'package:analyzer/analyzer.dart'; import 'package:code_builder/src/builders/shared.dart'; import 'package:code_builder/src/builders/statement.dart'; diff --git a/lib/src/builders/statement/if.dart b/lib/src/builders/statement/if.dart index ad3b9a9..768c8d2 100644 --- a/lib/src/builders/statement/if.dart +++ b/lib/src/builders/statement/if.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + import 'package:analyzer/dart/ast/ast.dart'; import 'package:code_builder/src/builders/expression.dart'; import 'package:code_builder/src/builders/shared.dart'; diff --git a/lib/src/builders/type/new_instance.dart b/lib/src/builders/type/new_instance.dart index c2d9b68..05b9b9d 100644 --- a/lib/src/builders/type/new_instance.dart +++ b/lib/src/builders/type/new_instance.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + part of code_builder.src.builders.type; /// Lazily builds an [InstanceCreationExpression] AST when built. diff --git a/lib/src/tokens.dart b/lib/src/tokens.dart index 17e70b5..9b97264 100644 --- a/lib/src/tokens.dart +++ b/lib/src/tokens.dart @@ -35,6 +35,9 @@ final Token $colon = new Token(TokenType.COLON, 0); /// The `const` token. final Token $const = new KeywordToken(Keyword.CONST, 0); +/// The `deferred` token. +final Token $deferred = new KeywordToken(Keyword.DEFERRED, 0); + /// The `/` token. final Token $divide = new Token(TokenType.SLASH, 0); @@ -64,6 +67,9 @@ final Token $if = new KeywordToken(Keyword.IF, 0); // Simple tokens +/// The `hide` token. +final Token $hide = new StringToken(TokenType.KEYWORD, 'hide', 0); + /// The `implements` token. final Token $implements = new KeywordToken(Keyword.IMPLEMENTS, 0); @@ -121,6 +127,9 @@ final Token $return = new KeywordToken(Keyword.RETURN, 0); /// The ';' token. final Token $semicolon = new Token(TokenType.SEMICOLON, 0); +/// The `show` token. +final Token $show = new StringToken(TokenType.KEYWORD, 'show', 0); + /// The `static` token. final Token $static = new KeywordToken(Keyword.STATIC, 0); diff --git a/test/builders/expression_test.dart b/test/builders/expression_test.dart index 5d6b453..78f5198 100644 --- a/test/builders/expression_test.dart +++ b/test/builders/expression_test.dart @@ -37,9 +37,32 @@ void main() { expect(literal([1, 2, 3]), equalsSource(r'[1, 2, 3]')); }); + test('should emit a typed list', () { + expect( + list([1, 2, 3], type: lib$core.int), + equalsSource(r' [1, 2, 3]'), + ); + }); + test('should emit a map', () { expect(literal({1: 2, 2: 3}), equalsSource(r'{1 : 2, 2 : 3}')); }); + + test('should emit a typed map', () { + expect( + map( + { + 1: '2', + 2: '3', + }, + keyType: lib$core.int, + valueType: lib$core.String, + ), + equalsSource(r''' + {1 : '2', 2 : '3'} + '''), + ); + }); }); test('should emit an assert statemnet', () { diff --git a/test/builders/field_test.dart b/test/builders/field_test.dart index fcadb66..739e7a7 100644 --- a/test/builders/field_test.dart +++ b/test/builders/field_test.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + import 'package:code_builder/code_builder.dart'; import 'package:code_builder/dart/core.dart'; import 'package:code_builder/testing.dart'; diff --git a/test/builders/file_test.dart b/test/builders/file_test.dart new file mode 100644 index 0000000..f9f258c --- /dev/null +++ b/test/builders/file_test.dart @@ -0,0 +1,62 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:code_builder/code_builder.dart'; +import 'package:code_builder/testing.dart'; +import 'package:test/test.dart'; + +void main() { + group('$ImportBuilder', () { + test('should support "show"', () { + expect( + new ImportBuilder('package:foo/foo.dart')..show('Foo'), + equalsSource(r''' + import 'package:foo/foo.dart' show Foo; + '''), + ); + }); + + test('should support "show"', () { + expect( + new ImportBuilder('package:foo/foo.dart')..hide('Bar'), + equalsSource(r''' + import 'package:foo/foo.dart' hide Bar; + '''), + ); + }); + + test('should support "deferred as"', () { + expect( + new ImportBuilder( + 'package:foo/foo.dart', + deferred: true, + prefix: 'foo', + ), + equalsSource(r''' + import 'package:foo/foo.dart' deferred as foo; + '''), + ); + }); + }); + + group('$ExportBuilder', () { + test('should support "show"', () { + expect( + new ExportBuilder('package:foo/foo.dart')..show('Foo'), + equalsSource(r''' + export 'package:foo/foo.dart' show Foo; + '''), + ); + }); + + test('should support "show"', () { + expect( + new ExportBuilder('package:foo/foo.dart')..hide('Bar'), + equalsSource(r''' + export 'package:foo/foo.dart' hide Bar; + '''), + ); + }); + }); +} diff --git a/test/builders/reference_test.dart b/test/builders/reference_test.dart deleted file mode 100644 index f25ae74..0000000 --- a/test/builders/reference_test.dart +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'package:test/test.dart'; - -void main() { - group('reference', () {}); -} diff --git a/test/builders/shared_test.dart b/test/builders/shared_test.dart index a38a062..12a314f 100644 --- a/test/builders/shared_test.dart +++ b/test/builders/shared_test.dart @@ -2,6 +2,10 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + import 'package:code_builder/src/builders/shared.dart'; import 'package:code_builder/src/tokens.dart'; import 'package:test/test.dart'; diff --git a/test/builders/statement_test.dart b/test/builders/statement_test.dart index b899c85..5833a7e 100644 --- a/test/builders/statement_test.dart +++ b/test/builders/statement_test.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + import 'package:code_builder/code_builder.dart'; import 'package:code_builder/dart/core.dart'; import 'package:code_builder/testing.dart'; diff --git a/test/builders/type_test.dart b/test/builders/type_test.dart index b9ac7b8..323f972 100644 --- a/test/builders/type_test.dart +++ b/test/builders/type_test.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + import 'package:code_builder/code_builder.dart'; import 'package:code_builder/dart/core.dart'; import 'package:code_builder/testing.dart'; diff --git a/test/scope_test.dart b/test/scope_test.dart index 64b41d5..084d7af 100644 --- a/test/scope_test.dart +++ b/test/scope_test.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + import 'package:analyzer/analyzer.dart'; import 'package:code_builder/src/scope.dart'; import 'package:test/test.dart'; diff --git a/tool/presubmit.sh b/tool/presubmit.sh index 035e29e..364bee7 100755 --- a/tool/presubmit.sh +++ b/tool/presubmit.sh @@ -14,7 +14,7 @@ echo "PASSED" # Make sure we pass the analyzer echo "Checking dartanalyzer..." -FAILS_ANALYZER="$(find lib test -name "*.dart" | xargs dartanalyzer --options analysis_options.yaml)" +FAILS_ANALYZER="$(find lib test -name "*.dart" | xargs dartanalyzer --options .analysis_options)" if [[ $FAILS_ANALYZER == *"[error]"* ]] then echo "FAILED"