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

Unified Diff: lib/src/info.dart

Issue 12225039: Support for observable models, fixes #259 (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 side-by-side diff with in-line comments
Download patch
Index: lib/src/info.dart
diff --git a/lib/src/info.dart b/lib/src/info.dart
index 07fe994643b0b2240692420bdea4b0600d12c07c..a35a2d80889efbd229b8f1273dd3ea5090266554 100644
--- a/lib/src/info.dart
+++ b/lib/src/info.dart
@@ -12,9 +12,11 @@ import 'dart:collection' show SplayTreeMap, LinkedHashMap;
import 'dart:uri';
import 'package:html5lib/dom.dart';
+import 'package:analyzer_experimental/src/generated/ast.dart';
import 'package:csslib/parser.dart' as css;
import 'package:csslib/visitor.dart';
+import 'dart_parser.dart' show DartCodeInfo;
import 'file_system/path.dart';
import 'files.dart';
import 'messages.dart';
@@ -112,7 +114,13 @@ class PathInfo {
if (!outputPath.toString().contains('packages')) return outputPath;
var segments = outputPath.segments().map(
(segment) => segment == 'packages' ? '_from_packages' : segment);
- return new Path(segments.join('/'));
+ var rewrittenPath = segments.join('/');
+ if (outputPath.isAbsolute) {
+ // TODO(jmesserly): this is probably broken on Windows
+ // We need to switch to package:pathos
+ rewrittenPath = '/$rewrittenPath';
+ }
+ return new Path(rewrittenPath);
}
/**
@@ -163,7 +171,7 @@ typedef String NameMangler(String name, String suffix, [bool forceSuffix]);
abstract class LibraryInfo {
/** Whether there is any code associated with the page/component. */
- bool get codeAttached => inlinedCode != null || externalFile != null;
+ bool get codeAttached => userCode != null || externalFile != null;
Siggi Cherem (dart-lang) 2013/02/13 19:28:54 I can see how this works, but it's a bit confusing
Jennifer Messerly 2013/02/14 00:38:09 Good idea! That will simplify things. :)
/**
* The actual code, either inlined or from an external file, or `null` if none
@@ -171,15 +179,18 @@ abstract class LibraryInfo {
*/
DartCodeInfo userCode;
- /** The inlined code, if any. */
- String inlinedCode;
-
/** The name of the file sourced in a script tag, if any. */
Path externalFile;
/** Info asscociated with [externalFile], if any. */
FileInfo externalCode;
+ /**
+ * The inverse of [externalCode]. If this .dart file was imported via a script
+ * tag, this refers to the HTML file that imported it.
+ */
+ LibraryInfo htmlFile;
+
/** File where the top-level code was defined. */
Path get inputPath;
@@ -195,6 +206,15 @@ abstract class LibraryInfo {
*/
String _getOutputFilename(NameMangler mangle);
+ /** This is used in transforming Dart code to track modified files. */
+ bool modified = false;
+
+ /**
+ * This is used in transforming Dart code to compute files that reference
+ * [modified] files.
+ */
+ List<FileInfo> referencedBy = [];
+
/**
* Components used within this library unit. For [FileInfo] these are
* components used directly in the page. For [ComponentInfo] these are
@@ -632,43 +652,6 @@ class TemplateInfo extends ElementInfo {
*/
typedef String ActionDefinition(String elemVarName);
-/** Information extracted from a source Dart file. */
-class DartCodeInfo {
- /** Library qualified identifier, if any. */
- final String libraryName;
-
- /** Library which the code is part-of, if any. */
- final String partOf;
-
- /** Declared imports, exports, and parts. */
- final List<DartDirectiveInfo> directives;
-
- /** The rest of the code. */
- final String code;
-
- DartCodeInfo(this.libraryName, this.partOf, this.directives, this.code);
-}
-
-/** Information about a single import/export/part directive. */
-class DartDirectiveInfo {
- /** Directive's label: import, export, or part. */
- String label;
-
- /** Referenced uri being imported, exported, or included by a part. */
- String uri;
-
- /** Prefix used for imports, if any. */
- String prefix;
-
- /** Hidden identifiers. */
- List<String> hide;
-
- /** Shown identifiers. */
- List<String> show;
-
- DartDirectiveInfo(this.label, this.uri, [this.prefix, this.hide, this.show]);
-}
-
/**
* Find ElementInfo that associated with a particular DOM node.

Powered by Google App Engine
This is Rietveld 408576698