OLD | NEW |
---|---|
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 | 6 |
7 // library abstract_expressions; | 7 // library abstract_expressions; |
8 | 8 |
9 abstract class AbstractExpression {} | 9 abstract class AbstractExpression {} |
10 | 10 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 } | 94 } |
95 | 95 |
96 // library expressions; | 96 // library expressions; |
97 | 97 |
98 // import 'abstractExpressions.dart'; | 98 // import 'abstractExpressions.dart'; |
99 // import 'evaluator.dart'; | 99 // import 'evaluator.dart'; |
100 // import 'multiplication.dart'; | 100 // import 'multiplication.dart'; |
101 // import 'multiplicationEvaluator.dart'; | 101 // import 'multiplicationEvaluator.dart'; |
102 // import 'stringConverter.dart'; | 102 // import 'stringConverter.dart'; |
103 | 103 |
104 class Expression = | 104 class Expression = /// 00: static type warning |
rmacnak
2014/04/07 22:24:18
Should be declared abstract.
jwren
2014/04/07 22:34:41
Got it, marking the alias as abstract the warning
| |
105 AbstractExpression with ExpressionWithEval, ExpressionWithStringConversion; | 105 AbstractExpression with ExpressionWithEval, ExpressionWithStringConversion; // / 00: ok |
106 | 106 |
107 class Addition = | 107 class Addition = /// 00: ok |
rmacnak
2014/04/07 22:24:18
We don't expect warnings here.
jwren
2014/04/07 22:34:41
Correct. The special comment indicates that for t
| |
108 AbstractAddition<Expression> with AdditionWithEval<Expression>, | 108 AbstractAddition<Expression> with AdditionWithEval<Expression>, /// 00: ok |
109 AdditionWithStringConversion<Expression> imp lements Expression; | 109 AdditionWithStringConversion<Expression> imp lements Expression; /// 00: ok |
110 | 110 |
111 class Subtraction = | 111 class Subtraction = /// 00: ok |
rmacnak
2014/04/07 22:24:18
We don't expect warnings here.
| |
112 AbstractSubtraction<Expression> with SubtractionWithEval<Expression>, | 112 AbstractSubtraction<Expression> with SubtractionWithEval<Expression>, /// 00: ok |
113 SubtractionWithStringConversion<Expressio n> implements Expression; | 113 SubtractionWithStringConversion<Expressio n> implements Expression; /// 00: ok |
114 | 114 |
115 class Number = | 115 class Number = /// 00: ok |
rmacnak
2014/04/07 22:24:18
We don't expect warnings here.
| |
116 AbstractNumber with NumberWithEval, | 116 AbstractNumber with NumberWithEval, /// 00: ok |
117 NumberWithStringConversion implements Expression; | 117 NumberWithStringConversion implements Expression; /// 00: ok |
118 | 118 |
119 | 119 |
120 class Multiplication = | 120 class Multiplication = /// 00: ok |
rmacnak
2014/04/07 22:24:18
We don't expect warnings here.
| |
121 AbstractMultiplication<Expression> with MultiplicationWithEval<Expression>, | 121 AbstractMultiplication<Expression> with MultiplicationWithEval<Expression>, // / 00: ok |
122 MultiplicationWithStringConversion<Exp ression> implements Expression; | 122 MultiplicationWithStringConversion<Exp ression> implements Expression; /// 00: ok |
123 | 123 |
124 | 124 |
125 void main() { | 125 void main() { |
126 Expression e = new Multiplication(new Addition(new Number(4), new Number(2)), | 126 Expression e = new Multiplication(new Addition(new Number(4), new Number(2)), /// 00: ok |
127 new Subtraction(new Number(10), new Number(7 ))); | 127 new Subtraction(new Number(10), new Number(7 ))); /// 00: ok |
128 Expect.equals('((4 + 2)) * (10 - 7)) = 18', '$e = ${e.eval}'); | 128 Expect.equals('((4 + 2)) * (10 - 7)) = 18', '$e = ${e.eval}'); /// 00: ok |
129 } | 129 } |
OLD | NEW |