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

Side by Side Diff: packages/analyzer/lib/src/generated/testing/html_factory.dart

Issue 2990843002: Removed fixed dependencies (Closed)
Patch Set: Created 3 years, 4 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library engine.testing.html_factory;
6
7 import 'package:analyzer/src/generated/html.dart';
8
9 /**
10 * Utility methods to create HTML nodes.
11 */
12 @deprecated
13 class HtmlFactory {
14 static XmlAttributeNode attribute(String name, String value) {
15 Token nameToken = stringToken(name);
16 Token equalsToken = new Token.con1(TokenType.EQ, 0);
17 Token valueToken = stringToken(value);
18 return new XmlAttributeNode(nameToken, equalsToken, valueToken);
19 }
20
21 static Token gtToken() {
22 return new Token.con1(TokenType.GT, 0);
23 }
24
25 static Token ltsToken() {
26 return new Token.con1(TokenType.LT_SLASH, 0);
27 }
28
29 static Token ltToken() {
30 return new Token.con1(TokenType.LT, 0);
31 }
32
33 static HtmlScriptTagNode scriptTag(
34 [List<XmlAttributeNode> attributes = XmlAttributeNode.EMPTY_LIST]) {
35 return new HtmlScriptTagNode(ltToken(), stringToken("script"), attributes,
36 sgtToken(), null, null, null, null);
37 }
38
39 static HtmlScriptTagNode scriptTagWithContent(String contents,
40 [List<XmlAttributeNode> attributes = XmlAttributeNode.EMPTY_LIST]) {
41 Token attributeEnd = gtToken();
42 Token contentToken = stringToken(contents);
43 attributeEnd.setNext(contentToken);
44 Token contentEnd = ltsToken();
45 contentToken.setNext(contentEnd);
46 return new HtmlScriptTagNode(ltToken(), stringToken("script"), attributes,
47 attributeEnd, null, contentEnd, stringToken("script"), gtToken());
48 }
49
50 static Token sgtToken() {
51 return new Token.con1(TokenType.SLASH_GT, 0);
52 }
53
54 static Token stringToken(String value) {
55 return new Token.con2(TokenType.STRING, 0, value);
56 }
57
58 static XmlTagNode tagNode(String name,
59 [List<XmlAttributeNode> attributes = XmlAttributeNode.EMPTY_LIST]) {
60 return new XmlTagNode(ltToken(), stringToken(name), attributes, sgtToken(),
61 null, null, null, null);
62 }
63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698