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

Unified Diff: pkg/polymer/lib/src/build/linter.dart

Issue 211393006: Enables codegen support in polymer (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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
« no previous file with comments | « pkg/polymer/lib/src/build/common.dart ('k') | pkg/polymer/lib/src/build/mirrors_remover.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/lib/src/build/linter.dart
diff --git a/pkg/polymer/lib/src/build/linter.dart b/pkg/polymer/lib/src/build/linter.dart
index df3331894f2c75ef5e23101a4813aaec30335ca3..8c7fe96e2dddc381fabca8be347bcddea55ab059 100644
--- a/pkg/polymer/lib/src/build/linter.dart
+++ b/pkg/polymer/lib/src/build/linter.dart
@@ -214,14 +214,14 @@ class _LinterVisitor extends TreeVisitor {
_logger.error('Missing tag name of the custom element. Please include an '
'attribute like \'name="your-tag-name"\'.',
span: node.sourceSpan);
- } else if (!_isCustomTag(tagName)) {
+ } else if (!isCustomTagName(tagName)) {
_logger.error('Invalid name "$tagName". Custom element names must have '
'at least one dash and can\'t be any of the following names: '
- '${_invalidTagNames.keys.join(", ")}.',
+ '${invalidTagNames.keys.join(", ")}.',
span: node.sourceSpan);
}
- if (_elements[extendsTag] == null && _isCustomTag(extendsTag)) {
+ if (_elements[extendsTag] == null && isCustomTagName(extendsTag)) {
_logger.warning('custom element with name "$extendsTag" not found.',
span: node.sourceSpan);
}
@@ -232,10 +232,8 @@ class _LinterVisitor extends TreeVisitor {
// names='a b c' or names='a,b,c'
// record each name for publishing
- for (var attr in attrs.split(attrs.contains(',') ? ',' : ' ')) {
- // remove excess ws
- attr = attr.trim();
- if (!_validateCustomAttributeName(attr, attrsSpan)) break;
+ for (var attr in attrs.split(ATTRIBUTES_REGEX)) {
+ if (!_validateCustomAttributeName(attr.trim(), attrsSpan)) break;
}
}
@@ -299,7 +297,7 @@ class _LinterVisitor extends TreeVisitor {
var nodeTag = node.localName;
var hasIsAttribute;
var customTagName;
- if (_isCustomTag(nodeTag)) {
+ if (isCustomTagName(nodeTag)) {
// <fancy-button>
customTagName = nodeTag;
hasIsAttribute = false;
@@ -387,27 +385,6 @@ class _LinterVisitor extends TreeVisitor {
}
}
-
-// These names have meaning in SVG or MathML, so they aren't allowed as custom
-// tags.
-var _invalidTagNames = const {
- 'annotation-xml': '',
- 'color-profile': '',
- 'font-face': '',
- 'font-face-src': '',
- 'font-face-uri': '',
- 'font-face-format': '',
- 'font-face-name': '',
- 'missing-glyph': '',
-};
-
-/// Returns true if this is a valid custom element name. See:
-/// <https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html#dfn-custom-element-name>
-bool _isCustomTag(String name) {
- if (name == null || !name.contains('-')) return false;
- return !_invalidTagNames.containsKey(name);
-}
-
const String USE_INIT_DART =
'To run a polymer application, you need to call "initPolymer". You can '
'either include a generic script tag that does this for you:'
« no previous file with comments | « pkg/polymer/lib/src/build/common.dart ('k') | pkg/polymer/lib/src/build/mirrors_remover.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698