Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: samples/myapi/myapi_impl.dart

Issue 1209033003: Work in progres, please take a look and give early feedback if this is the way we want to structure… (Closed) Base URL: git@github.com:dart-lang/fletch.git@master
Patch Set: address comments Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « samples/myapi/myapi_client.cc ('k') | samples/todomvc/dart/todomvc_service.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file
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.md file.
4
5 library myapi_impl;
6
7 const myapi = const Api('MyApi');
8
9 int calls = 0;
10 @myapi MyObject foo() {
11 return (calls++ & 1 == 0) ? new Bar() : new Baz();
12 }
13
14 abstract class MyObject {
15 @myapi void funk(MyObject o);
16 }
17
18 class Bar implements MyObject {
19 void funk(MyObject o) {
20 print("Bar!");
21 if (o != null) o.funk(null);
22 }
23 }
24
25 class Baz implements MyObject {
26 void funk(MyObject o) {
27 print("Baz!");
28 if (o != null) o.funk(null);
29 }
30 }
31
32
33 // ---------------------------------------------------------------
34
35 class Api {
36 final String name;
37 const Api(this.name);
38 }
OLDNEW
« no previous file with comments | « samples/myapi/myapi_client.cc ('k') | samples/todomvc/dart/todomvc_service.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698