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

Side by Side Diff: pkg/compiler/lib/src/native/behavior.dart

Issue 1053053003: Add 'toString' method to NativeBehavior (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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);
11 11
12 /// The type Object, but no subtypes: 12 /// The type Object, but no subtypes:
13 static const JsObject = const SpecialType._('=Object'); 13 static const JsObject = const SpecialType._('=Object');
14 14
15 int get hashCode => name.hashCode; 15 int get hashCode => name.hashCode;
16 } 16 }
17 17
18 /** 18 /**
19 * A summary of the behavior of a native element. 19 * A summary of the behavior of a native element.
20 * 20 *
21 * Native code can return values of one type and cause native subtypes of 21 * Native code can return values of one type and cause native subtypes of
22 * another type to be instantiated. By default, we compute both from the 22 * another type to be instantiated. By default, we compute both from the
23 * declared type. 23 * declared type.
24 * 24 *
25 * A field might yield any native type that 'is' the field type. 25 * A field might yield any native type that 'is' the field type.
(...skipping 26 matching lines...) Expand all
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 String toString() {
63 return 'NativeBehavior(returns: ${typesReturned}, '
64 'creates: ${typesInstantiated}, '
65 'sideEffects: ${sideEffects})';
66 }
67
68
62 /// Processes the type specification string of a call to JS and stores the 69 /// Processes the type specification string of a call to JS and stores the
63 /// result in the [typesReturned] and [typesInstantiated]. It furthermore 70 /// result in the [typesReturned] and [typesInstantiated]. It furthermore
64 /// computes the side effects, and, if given, invokes [setSideEffects] with 71 /// computes the side effects, and, if given, invokes [setSideEffects] with
65 /// the computed effects. If no side effects are encoded in the [specString] 72 /// the computed effects. If no side effects are encoded in the [specString]
66 /// the [setSideEffects] method is not invoked. 73 /// the [setSideEffects] method is not invoked.
67 /// 74 ///
68 /// Two forms of the string is supported: 75 /// Two forms of the string is supported:
69 /// 1) A single type string of the form 'void', '', 'var' or 'T1|...|Tn' 76 /// 1) A single type string of the form 'void', '', 'var' or 'T1|...|Tn'
70 /// which defines the types returned and for the later form also created by 77 /// which defines the types returned and for the later form also created by
71 /// the call to JS. 78 /// the call to JS.
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 _errorNode(locationNodeOrElement, compiler), 546 _errorNode(locationNodeOrElement, compiler),
540 "Type '$typeString' not found."); 547 "Type '$typeString' not found.");
541 return null; 548 return null;
542 } 549 }
543 550
544 static _errorNode(locationNodeOrElement, compiler) { 551 static _errorNode(locationNodeOrElement, compiler) {
545 if (locationNodeOrElement is Node) return locationNodeOrElement; 552 if (locationNodeOrElement is Node) return locationNodeOrElement;
546 return locationNodeOrElement.parseNode(compiler); 553 return locationNodeOrElement.parseNode(compiler);
547 } 554 }
548 } 555 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698