| 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 part of native; | 5 part of native; |
| 6 | 6 |
| 7 /// This class is a temporary work-around until we get a more powerful DartType. | 7 /// This class is a temporary work-around until we get a more powerful DartType. |
| 8 class SpecialType { | 8 class SpecialType { |
| 9 final String name; | 9 final String name; |
| 10 const SpecialType._(this.name); | 10 const SpecialType._(this.name); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 /// [DartType]s or [SpecialType]s instantiated by the native element. | 53 /// [DartType]s or [SpecialType]s instantiated by the native element. |
| 54 final List typesInstantiated = []; | 54 final List typesInstantiated = []; |
| 55 | 55 |
| 56 // If this behavior is for a JS expression, [codeTemplate] contains the | 56 // If this behavior is for a JS expression, [codeTemplate] contains the |
| 57 // parsed tree. | 57 // parsed tree. |
| 58 js.Template codeTemplate; | 58 js.Template codeTemplate; |
| 59 | 59 |
| 60 final SideEffects sideEffects = new SideEffects.empty(); | 60 final SideEffects sideEffects = new SideEffects.empty(); |
| 61 | 61 |
| 62 static NativeBehavior NONE = new NativeBehavior(); | |
| 63 | |
| 64 /// Processes the type specification string of a call to JS and stores the | 62 /// Processes the type specification string of a call to JS and stores the |
| 65 /// result in the [typesReturned] and [typesInstantiated]. | 63 /// result in the [typesReturned] and [typesInstantiated]. |
| 66 /// | 64 /// |
| 67 /// Two forms of the string is supported: | 65 /// Two forms of the string is supported: |
| 68 /// 1) A single type string of the form 'void', '', 'var' or 'T1|...|Tn' | 66 /// 1) A single type string of the form 'void', '', 'var' or 'T1|...|Tn' |
| 69 /// which defines the types returned and for the later form also created by | 67 /// which defines the types returned and for the later form also created by |
| 70 /// the call to JS. | 68 /// the call to JS. |
| 71 /// 2) A sequence of the form '<tag>:<type-string>;' where <tag> is either | 69 /// 2) A sequence of the form '<tag>:<type-string>;' where <tag> is either |
| 72 /// 'returns' or 'creates' and where <type-string> is a type string like in | 70 /// 'returns' or 'creates' and where <type-string> is a type string like in |
| 73 /// 1). The type string marked by 'returns' defines the types returned and | 71 /// 1). The type string marked by 'returns' defines the types returned and |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 compiler.internalError( | 427 compiler.internalError( |
| 430 _errorNode(locationNodeOrElement, compiler), | 428 _errorNode(locationNodeOrElement, compiler), |
| 431 "Type '$typeString' not found."); | 429 "Type '$typeString' not found."); |
| 432 } | 430 } |
| 433 | 431 |
| 434 static _errorNode(locationNodeOrElement, compiler) { | 432 static _errorNode(locationNodeOrElement, compiler) { |
| 435 if (locationNodeOrElement is Node) return locationNodeOrElement; | 433 if (locationNodeOrElement is Node) return locationNodeOrElement; |
| 436 return locationNodeOrElement.parseNode(compiler); | 434 return locationNodeOrElement.parseNode(compiler); |
| 437 } | 435 } |
| 438 } | 436 } |
| OLD | NEW |