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

Side by Side Diff: lib/src/analyzer.dart

Issue 12096106: work in progress: observable implementation using detailed change records (Closed) Base URL: https://github.com/dart-lang/web-ui.git@master
Patch Set: Created 7 years, 10 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 | « lib/observe/set.dart ('k') | lib/src/codegen.dart » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** 5 /**
6 * Part of the template compilation that concerns with extracting information 6 * Part of the template compilation that concerns with extracting information
7 * from the HTML parse tree. 7 * from the HTML parse tree.
8 */ 8 */
9 library analyzer; 9 library analyzer;
10 10
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 } 690 }
691 691
692 /** 692 /**
693 * Stores a direct reference in [info] to a dart source file that was loaded 693 * Stores a direct reference in [info] to a dart source file that was loaded
694 * in a script tag with the 'src' attribute. 694 * in a script tag with the 'src' attribute.
695 */ 695 */
696 void _attachExtenalScript(LibraryInfo info, Map<Path, FileInfo> files) { 696 void _attachExtenalScript(LibraryInfo info, Map<Path, FileInfo> files) {
697 var path = info.externalFile; 697 var path = info.externalFile;
698 if (path != null) { 698 if (path != null) {
699 info.externalCode = files[path]; 699 info.externalCode = files[path];
700 info.externalCode.htmlFile = info;
700 info.userCode = info.externalCode.userCode; 701 info.userCode = info.externalCode.userCode;
701 } 702 }
702 } 703 }
703 704
704 /** Adds a component's tag name to the names in scope for [fileInfo]. */ 705 /** Adds a component's tag name to the names in scope for [fileInfo]. */
705 void _addComponent(FileInfo fileInfo, ComponentInfo componentInfo) { 706 void _addComponent(FileInfo fileInfo, ComponentInfo componentInfo) {
706 var existing = fileInfo.components[componentInfo.tagName]; 707 var existing = fileInfo.components[componentInfo.tagName];
707 if (existing != null) { 708 if (existing != null) {
708 if (existing == componentInfo) { 709 if (existing == componentInfo) {
709 // This is the same exact component as the existing one. 710 // This is the same exact component as the existing one.
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 // text/javascript. Because this might be a common error, we warn about it 862 // text/javascript. Because this might be a common error, we warn about it
862 // and force explicit type="text/javascript". 863 // and force explicit type="text/javascript".
863 // TODO(jmesserly): is this a good warning? 864 // TODO(jmesserly): is this a good warning?
864 _messages.warning('ignored script tag, possibly missing ' 865 _messages.warning('ignored script tag, possibly missing '
865 'type="application/dart" or type="text/javascript":', 866 'type="application/dart" or type="text/javascript":',
866 node.sourceSpan, file: _fileInfo.path); 867 node.sourceSpan, file: _fileInfo.path);
867 } 868 }
868 869
869 if (scriptType != 'application/dart') return; 870 if (scriptType != 'application/dart') return;
870 871
871 var src = node.attributes["src"]; 872 var src = node.attributes['src'];
872 if (src != null) { 873 if (src != null) {
873 if (!src.endsWith('.dart')) { 874 if (!src.endsWith('.dart')) {
874 _messages.warning('"application/dart" scripts should ' 875 _messages.warning('"application/dart" scripts should '
875 'use the .dart file extension.', 876 'use the .dart file extension.',
876 node.sourceSpan, file: _fileInfo.path); 877 node.sourceSpan, file: _fileInfo.path);
877 } 878 }
878 879
879 if (node.innerHtml.trim() != '') { 880 if (node.innerHtml.trim() != '') {
880 _messages.error('script tag has "src" attribute and also has script ' 881 _messages.error('script tag has "src" attribute and also has script '
881 'text.', node.sourceSpan, file: _fileInfo.path); 882 'text.', node.sourceSpan, file: _fileInfo.path);
(...skipping 22 matching lines...) Expand all
904 assert(node.nodes.length == 1); 905 assert(node.nodes.length == 1);
905 Text text = node.nodes[0]; 906 Text text = node.nodes[0];
906 907
907 if (_currentInfo.codeAttached) { 908 if (_currentInfo.codeAttached) {
908 _tooManyScriptsError(node); 909 _tooManyScriptsError(node);
909 } else if (_currentInfo == _fileInfo && !_fileInfo.isEntryPoint) { 910 } else if (_currentInfo == _fileInfo && !_fileInfo.isEntryPoint) {
910 _messages.warning('top-level dart code is ignored on ' 911 _messages.warning('top-level dart code is ignored on '
911 ' HTML pages that define components, but are not the entry HTML ' 912 ' HTML pages that define components, but are not the entry HTML '
912 'file.', node.sourceSpan, file: _fileInfo.path); 913 'file.', node.sourceSpan, file: _fileInfo.path);
913 } else { 914 } else {
914 _currentInfo.inlinedCode = text.value;
915 _currentInfo.userCode = parseDartCode(text.value, 915 _currentInfo.userCode = parseDartCode(text.value,
916 _currentInfo.inputPath, messages:_messages); 916 _currentInfo.inputPath, messages:_messages);
917 if (_currentInfo.userCode.partOf != null) { 917 if (_currentInfo.userCode.partOf != null) {
918 _messages.error('expected a library, not a part.', 918 _messages.error('expected a library, not a part.',
919 node.sourceSpan, file: _fileInfo.path); 919 node.sourceSpan, file: _fileInfo.path);
920 } 920 }
921 } 921 }
922 } 922 }
923 923
924 void _tooManyScriptsError(Node node) { 924 void _tooManyScriptsError(Node node) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 if (start == null) moveNext(); 989 if (start == null) moveNext();
990 if (start < length) { 990 if (start < length) {
991 do { 991 do {
992 bindings.add(binding); 992 bindings.add(binding);
993 content.add(textContent); 993 content.add(textContent);
994 } while (moveNext()); 994 } while (moveNext());
995 } 995 }
996 content.add(textContent); 996 content.add(textContent);
997 } 997 }
998 } 998 }
OLDNEW
« no previous file with comments | « lib/observe/set.dart ('k') | lib/src/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698