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

Side by Side Diff: samples/myapi/generated/myapi_service_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/generated/myapi_service.idl ('k') | samples/myapi/myapi.gyp » ('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 import 'dart/myapi_service.dart';
6 import '../myapi_impl.dart' as impl;
7
8 class ApiService {
9 final Map<int, List> objects = {};
10
11 int create() {
12 int api = objects.length;
13 objects[api] = new List();
14 return api;
15 }
16
17 void destroy(int api) {
18 objects[api].clear();
19 }
20
21 int register(int api, Object o) {
22 List list = objects[api];
23 int index = list.indexOf(o);
24 if (index >= 0) return index;
25 index = list.length;
26 list.add(o);
27 return index;
28 }
29 }
30
31 class MyApiServiceImpl extends ApiService implements MyApiService {
32 int foo(int api) {
33 impl.MyObject result = impl.foo();
34 return register(api, result);
35 }
36
37 void MyObject_funk(int api, int id, int o) {
38 impl.MyObject object = objects[api][id];
39 object.funk(objects[api][o]);
40 }
41 }
42
43 void main() {
44 var impl = new MyApiServiceImpl();
45 MyApiService.initialize(impl);
46 while (MyApiService.hasNextEvent()) {
47 MyApiService.handleNextEvent();
48 }
49 }
OLDNEW
« no previous file with comments | « samples/myapi/generated/myapi_service.idl ('k') | samples/myapi/myapi.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698