Skip to content

Allow mixins that call super #1555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 4, 2017
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
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ analyzer:
strong-mode: true
language:
enableGenericMethods: true
enableSuperMixins: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we using this feature in the dartdoc codebase? I'm curious why you're turning it on here...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1541 -- A flutter user tried to do this. Flutter could be using it in their codebase -- it is enabled in their analysis options -- but I guess they just haven't yet or otherwise dartdoc wouldn't have worked for them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, nvm, you mean why in analysis_options.yaml. The test code has this now.

exclude:
- 'doc/**'
- 'lib/templates/*.html'
Expand Down
5 changes: 3 additions & 2 deletions lib/src/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4967,8 +4967,9 @@ class PackageBuilder {
AnalysisContext get context {
if (_context == null) {
// TODO(jcollins-g): fix this so it actually obeys analyzer options files.
var options = new AnalysisOptionsImpl()..enableAssertInitializer = true;

var options = new AnalysisOptionsImpl();
options.enableAssertInitializer = true;
options.enableSuperMixins = true;
AnalysisEngine.instance.processRequiredPlugins();

_context = AnalysisEngine.instance.createAnalysisContext()
Expand Down
12 changes: 12 additions & 0 deletions testing/test_package/lib/fake.dart
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,18 @@ abstract class Interface {}
/// Yet another interface that can be implemented.
abstract class AnotherInterface {}

class NotAMixin {
String get superString => "A string that's clearly important";
}

class AMixinCallingSuper extends NotAMixin {
@override
String get superString => "${super.superString} but not as important as this";
}

/// Verify super-mixins don't break Dartdoc.
class AClassUsingASuperMixin extends AnotherInterface with AMixinCallingSuper {}

/// A super class, with many powers. Link to [Apple] from another library.
@deprecated
class SuperAwesomeClass {
Expand Down
284 changes: 284 additions & 0 deletions testing/test_package_docs/fake/AClassUsingASuperMixin-class.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,284 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="API docs for the AClassUsingASuperMixin class from the fake library, for the Dart programming language.">
<title>AClassUsingASuperMixin class - fake library - Dart API</title>
<!-- required because all the links are pseudo-absolute -->
<base href="..">

<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500,400i,400,300|Source+Sans+Pro:400,300,700" rel="stylesheet">
<link rel="stylesheet" href="static-assets/github.css">
<link rel="stylesheet" href="static-assets/styles.css">
<link rel="icon" href="static-assets/favicon.png">

</head>

<body>

<div id="overlay-under-drawer"></div>

<header id="title">
<button id="sidenav-left-toggle" type="button">&nbsp;</button>
<ol class="breadcrumbs gt-separated dark hidden-xs">
<li><a href="index.html">test_package</a></li>
<li><a href="fake/fake-library.html">fake</a></li>
<li class="self-crumb">class AClassUsingASuperMixin</li>
</ol>
<div class="self-name">AClassUsingASuperMixin</div>
<form class="search navbar-right" role="search">
<input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
</form>
</header>

<main>

<div class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
<h5>library fake</h5>
<ol>
<li class="section-title"><a href="fake/fake-library.html#classes">Classes</a></li>
<li><a href="fake/AClassUsingASuperMixin-class.html">AClassUsingASuperMixin</a></li>
<li><a href="fake/AMixinCallingSuper-class.html">AMixinCallingSuper</a></li>
<li><a href="fake/Annotation-class.html">Annotation</a></li>
<li><a href="fake/AnotherInterface-class.html">AnotherInterface</a></li>
<li><a href="fake/BaseForDocComments-class.html">BaseForDocComments</a></li>
<li><a href="fake/BaseThingy-class.html">BaseThingy</a></li>
<li><a href="fake/BaseThingy2-class.html">BaseThingy2</a></li>
<li><a href="fake/ClassWithUnusualProperties-class.html">ClassWithUnusualProperties</a></li>
<li><a href="fake/ConstantClass-class.html">ConstantClass</a></li>
<li><a href="fake/Cool-class.html">Cool</a></li>
<li><a href="fake/ExtraSpecialList-class.html">ExtraSpecialList</a></li>
<li><a href="fake/Foo2-class.html">Foo2</a></li>
<li><a href="fake/HasGenerics-class.html">HasGenerics</a></li>
<li><a href="fake/HasGenericWithExtends-class.html">HasGenericWithExtends</a></li>
<li><a href="fake/ImplementingThingy-class.html">ImplementingThingy</a></li>
<li><a href="fake/ImplementingThingy2-class.html">ImplementingThingy2</a></li>
<li><a href="fake/ImplicitProperties-class.html">ImplicitProperties</a></li>
<li><a href="fake/Interface-class.html">Interface</a></li>
<li><a href="fake/LongFirstLine-class.html">LongFirstLine</a></li>
<li><a href="fake/MixMeIn-class.html">MixMeIn</a></li>
<li><a href="fake/NotAMixin-class.html">NotAMixin</a></li>
<li><a href="fake/OperatorReferenceClass-class.html">OperatorReferenceClass</a></li>
<li><a href="fake/OtherGenericsThing-class.html">OtherGenericsThing</a></li>
<li><a href="fake/SpecialList-class.html">SpecialList</a></li>
<li><a href="fake/SubForDocComments-class.html">SubForDocComments</a></li>
<li><a class="deprecated" href="fake/SuperAwesomeClass-class.html">SuperAwesomeClass</a></li>
<li><a href="fake/WithGetterAndSetter-class.html">WithGetterAndSetter</a></li>

<li class="section-title"><a href="fake/fake-library.html#constants">Constants</a></li>
<li><a href="fake/CUSTOM_CLASS-constant.html">CUSTOM_CLASS</a></li>
<li><a class="deprecated" href="fake/DOWN-constant.html">DOWN</a></li>
<li><a href="fake/greatAnnotation-constant.html">greatAnnotation</a></li>
<li><a href="fake/greatestAnnotation-constant.html">greatestAnnotation</a></li>
<li><a href="fake/incorrectDocReference-constant.html">incorrectDocReference</a></li>
<li><a href="fake/NAME_SINGLEUNDERSCORE-constant.html">NAME_SINGLEUNDERSCORE</a></li>
<li><a href="fake/NAME_WITH_TWO_UNDERSCORES-constant.html">NAME_WITH_TWO_UNDERSCORES</a></li>
<li><a href="fake/PI-constant.html">PI</a></li>
<li><a href="fake/required-constant.html">required</a></li>
<li><a href="fake/testingCodeSyntaxInOneLiners-constant.html">testingCodeSyntaxInOneLiners</a></li>
<li><a href="fake/UP-constant.html">UP</a></li>
<li><a href="fake/ZERO-constant.html">ZERO</a></li>

<li class="section-title"><a href="fake/fake-library.html#properties">Properties</a></li>
<li><a href="fake/dynamicGetter.html">dynamicGetter</a></li>
<li><a href="fake/getterSetterNodocGetter.html">getterSetterNodocGetter</a></li>
<li><a href="fake/getterSetterNodocSetter.html">getterSetterNodocSetter</a></li>
<li><a href="fake/justGetter.html">justGetter</a></li>
<li><a href="fake/justSetter.html">justSetter</a></li>
<li><a href="fake/mapWithDynamicKeys.html">mapWithDynamicKeys</a></li>
<li><a class="deprecated" href="fake/meaningOfLife.html">meaningOfLife</a></li>
<li><a href="fake/setAndGet.html">setAndGet</a></li>
<li><a href="fake/simpleProperty.html">simpleProperty</a></li>

<li class="section-title"><a href="fake/fake-library.html#functions">Functions</a></li>
<li><a href="fake/addCallback.html">addCallback</a></li>
<li><a href="fake/addCallback2.html">addCallback2</a></li>
<li><a href="fake/functionWithFunctionParameters.html">functionWithFunctionParameters</a></li>
<li><a href="fake/myGenericFunction.html">myGenericFunction</a></li>
<li><a href="fake/onlyPositionalWithNoDefaultNoType.html">onlyPositionalWithNoDefaultNoType</a></li>
<li><a href="fake/paintImage1.html">paintImage1</a></li>
<li><a href="fake/paintImage2.html">paintImage2</a></li>
<li><a href="fake/paramFromAnotherLib.html">paramFromAnotherLib</a></li>
<li><a href="fake/short.html">short</a></li>
<li><a href="fake/soIntense.html">soIntense</a></li>
<li><a href="fake/thisIsAlsoAsync.html">thisIsAlsoAsync</a></li>
<li><a href="fake/thisIsAsync.html">thisIsAsync</a></li>
<li><a class="deprecated" href="fake/topLevelFunction.html">topLevelFunction</a></li>

<li class="section-title"><a href="fake/fake-library.html#enums">Enums</a></li>
<li><a href="fake/Color-class.html">Color</a></li>

<li class="section-title"><a href="fake/fake-library.html#typedefs">Typedefs</a></li>
<li><a href="fake/Callback2.html">Callback2</a></li>
<li><a class="deprecated" href="fake/FakeProcesses.html">FakeProcesses</a></li>
<li><a href="fake/GenericTypedef.html">GenericTypedef</a></li>
<li><a href="fake/LotsAndLotsOfParameters.html">LotsAndLotsOfParameters</a></li>
<li><a href="fake/myCoolTypedef.html">myCoolTypedef</a></li>
<li><a href="fake/NewGenericTypedef.html">NewGenericTypedef</a></li>
<li><a href="fake/VoidCallback.html">VoidCallback</a></li>

<li class="section-title"><a href="fake/fake-library.html#exceptions">Exceptions</a></li>
<li><a class="deprecated" href="fake/Doh-class.html">Doh</a></li>
<li><a href="fake/Oops-class.html">Oops</a></li>
</ol>
</div>

<div class="col-xs-12 col-sm-9 col-md-8 main-content">

<section class="desc markdown">
<p>Verify super-mixins don't break Dartdoc.</p>
</section>

<section>
<dl class="dl-horizontal">
<dt>Inheritance</dt>
<dd><ul class="gt-separated dark clazz-relationships">
<li>Object</li>
<li><a href="fake/AnotherInterface-class.html">AnotherInterface</a></li>
<li>AClassUsingASuperMixin</li>
</ul></dd>


<dt>Mixes-in</dt>
<dd><ul class="comma-separated clazz-relationships">
<li><a href="fake/AMixinCallingSuper-class.html">AMixinCallingSuper</a></li>
</ul></dd>


</dl>
</section>

<section class="summary offset-anchor" id="constructors">
<h2>Constructors</h2>

<dl class="constructor-summary-list">
<dt id="AClassUsingASuperMixin" class="callable">
<span class="name"><a href="fake/AClassUsingASuperMixin/AClassUsingASuperMixin.html">AClassUsingASuperMixin</a></span><span class="signature">()</span>
</dt>
<dd>

</dd>
</dl>
</section>

<section class="summary offset-anchor inherited" id="instance-properties">
<h2>Properties</h2>

<dl class="properties">
<dt id="hashCode" class="property inherited">
<span class="name"><a href="fake/AnotherInterface/hashCode.html">hashCode</a></span>
<span class="signature">&#8594; int</span>
</dt>
<dd class="inherited">

<div class="features">read-only, inherited</div>
</dd>
<dt id="runtimeType" class="property inherited">
<span class="name"><a href="fake/AnotherInterface/runtimeType.html">runtimeType</a></span>
<span class="signature">&#8594; Type</span>
</dt>
<dd class="inherited">

<div class="features">read-only, inherited</div>
</dd>
<dt id="superString" class="property inherited">
<span class="name"><a href="fake/AMixinCallingSuper/superString.html">superString</a></span>
<span class="signature">&#8594; String</span>
</dt>
<dd class="inherited">

<div class="features">read-only, inherited</div>
</dd>
</dl>
</section>

<section class="summary offset-anchor inherited" id="instance-methods">
<h2>Methods</h2>
<dl class="callables">
<dt id="noSuchMethod" class="callable inherited">
<span class="name"><a href="fake/AnotherInterface/noSuchMethod.html">noSuchMethod</a></span><span class="signature">(<wbr><span class="parameter" id="noSuchMethod-param-invocation"><span class="type-annotation">Invocation</span> <span class="parameter-name">invocation</span></span>)
<span class="returntype parameter">&#8594; dynamic</span>
</span>
</dt>
<dd class="inherited">

<div class="features">inherited</div>
</dd>
<dt id="toString" class="callable inherited">
<span class="name"><a href="fake/AnotherInterface/toString.html">toString</a></span><span class="signature">(<wbr>)
<span class="returntype parameter">&#8594; String</span>
</span>
</dt>
<dd class="inherited">

<div class="features">inherited</div>
</dd>
</dl>
</section>

<section class="summary offset-anchor inherited" id="operators">
<h2>Operators</h2>
<dl class="callables">
<dt id="operator ==" class="callable inherited">
<span class="name"><a href="fake/AnotherInterface/operator_equals.html">operator ==</a></span><span class="signature">(<wbr><span class="parameter" id="==-param-other"><span class="parameter-name">other</span></span>)
<span class="returntype parameter">&#8594; bool</span>
</span>
</dt>
<dd class="inherited">

<div class="features">inherited</div>
</dd>
</dl>
</section>




</div> <!-- /.main-content -->

<div class="col-xs-6 col-sm-6 col-md-2 sidebar sidebar-offcanvas-right">
<h5>class AClassUsingASuperMixin</h5>
<ol>
<li class="section-title"><a href="fake/AClassUsingASuperMixin-class.html#constructors">Constructors</a></li>
<li><a href="fake/AClassUsingASuperMixin/AClassUsingASuperMixin.html">AClassUsingASuperMixin</a></li>

<li class="section-title inherited">
<a href="fake/AClassUsingASuperMixin-class.html#instance-properties">Properties</a>
</li>
<li class="inherited"><a href="fake/AnotherInterface/hashCode.html">hashCode</a></li>
<li class="inherited"><a href="fake/AnotherInterface/runtimeType.html">runtimeType</a></li>
<li class="inherited"><a href="fake/AMixinCallingSuper/superString.html">superString</a></li>

<li class="section-title inherited"><a href="fake/AClassUsingASuperMixin-class.html#instance-methods">Methods</a></li>
<li class="inherited"><a href="fake/AnotherInterface/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="fake/AnotherInterface/toString.html">toString</a></li>

<li class="section-title inherited"><a href="fake/AClassUsingASuperMixin-class.html#operators">Operators</a></li>
<li class="inherited"><a href="fake/AnotherInterface/operator_equals.html">operator ==</a></li>



</ol>
</div><!--/.sidebar-offcanvas-->

</main>

<footer>
<span class="no-break">
test_package 0.0.1
</span>

</footer>

<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="static-assets/typeahead.bundle.min.js"></script>
<script src="static-assets/highlight.pack.js"></script>
<script src="static-assets/URI.js"></script>
<script src="static-assets/script.js"></script>


</body>

</html>
Loading