summaryrefslogtreecommitdiffstats
path: root/tools/json_schema_compiler/dart_test/functions.dart
blob: 6c31c81d2a049a794988f38b09f00ae60efe35f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// Copyright (c) 2013, 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.

// Generated from namespace: functions

part of chrome;

/**
 * Types
 */

class FunctionsDictType extends ChromeObject {
  /*
   * Private constructor
   */
  FunctionsDictType._proxy(_jsObject) : super._proxy(_jsObject);

  /*
   * Public accessors
   */
  /// A field.
  int get a => JS('int', '#.a', this._jsObject);

  void set a(int a) {
    JS('void', '#.a = #', this._jsObject, a);
  }


  /*
   * Methods
   */
  /// A parameter.
  void voidFunc() => JS('void', '#.voidFunc()', this._jsObject);

}

/**
 * Functions
 */

class API_functions {
  /*
   * API connection
   */
  Object _jsObject;

  /*
   * Functions
   */
  /// Simple function.
  void voidFunc() => JS('void', '#.voidFunc()', this._jsObject);

  /// Function taking a non-optional argument.
  void argFunc(String s) => JS('void', '#.argFunc(#)', this._jsObject, s);

  /// Function taking an optional argument.
  void optionalArgFunc([String s]) => JS('void', '#.optionalArgFunc(#)', this._jsObject, s);

  /// Function taking a non-optional dictionary argument.
  void dictArgFunc(FunctionsDictType d) => JS('void', '#.dictArgFunc(#)', this._jsObject, convertArgument(d));

  /// Function taking an optional dictionary argument.
  void optionalDictArgFunc([FunctionsDictType d]) => JS('void', '#.optionalDictArgFunc(#)', this._jsObject, convertArgument(d));

  /// Function taking an entry argument.
  void entryArgFunc(Object entry) => JS('void', '#.entryArgFunc(#)', this._jsObject, convertArgument(entry));

  /// Function taking a simple callback.
  void callbackFunc(void c()) => JS('void', '#.callbackFunc(#)', this._jsObject, convertDartClosureToJS(c, 0));

  /// Function taking an optional simple callback.
  void optionalCallbackFunc([void c()]) => JS('void', '#.optionalCallbackFunc(#)', this._jsObject, convertDartClosureToJS(c, 0));

  /// Function taking a primitive callback.
  void primitiveCallbackFunc(void c(int i)) => JS('void', '#.primitiveCallbackFunc(#)', this._jsObject, convertDartClosureToJS(c, 1));

  /// Function taking a dictionary callback.
  void dictCallbackFunc(void c(DictType dict)) {
    void __proxy_callback(dict) {
      if (?c) {
        c(new DictType._proxy(dict));
      }
    }
    JS('void', '#.dictCallbackFunc(#)', this._jsObject, convertDartClosureToJS(__proxy_callback, 1));
  }

  /// Function returning a dictionary.
  FunctionsDictType dictRetFunc() => new FunctionsDictType._proxy(JS('', '#.dictRetFunc()', this._jsObject));

  API_functions(this._jsObject) {
  }
}