OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library ddc.runtime.dart_runtime; | 5 library ddc.runtime.dart_runtime; |
6 | 6 |
7 import 'dart:mirrors'; | 7 import 'dart:mirrors'; |
8 | 8 |
9 import 'package:ddc/config.dart'; | 9 import 'package:dev_compiler/config.dart'; |
10 | 10 |
11 dynamic dload(dynamic obj, String field) { | 11 dynamic dload(dynamic obj, String field) { |
12 var symbol = new Symbol(field); | 12 var symbol = new Symbol(field); |
13 var mirror = reflect(obj); | 13 var mirror = reflect(obj); |
14 // TODO(vsm): Does this create an NSM? | 14 // TODO(vsm): Does this create an NSM? |
15 var fieldMirror = mirror.getField(symbol); | 15 var fieldMirror = mirror.getField(symbol); |
16 return fieldMirror.reflectee; | 16 return fieldMirror.reflectee; |
17 } | 17 } |
18 | 18 |
19 dynamic dinvokef(dynamic f, List args) { | 19 dynamic dinvokef(dynamic f, List args) { |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 ret1 = call1.returnType; | 329 ret1 = call1.returnType; |
330 params1 = call1.parameters; | 330 params1 = call1.parameters; |
331 } | 331 } |
332 | 332 |
333 // Any type that implements a call method implicitly subtypes Function. | 333 // Any type that implements a call method implicitly subtypes Function. |
334 if (_reflects(c2, Function)) return true; | 334 if (_reflects(c2, Function)) return true; |
335 | 335 |
336 // Check structural function subtyping | 336 // Check structural function subtyping |
337 return _isFunctionSubTypeHelper(ret1, params1, c2.returnType, c2.parameters); | 337 return _isFunctionSubTypeHelper(ret1, params1, c2.returnType, c2.parameters); |
338 } | 338 } |
OLD | NEW |