Skip to content

Commit

Permalink
fix: lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
gcclll committed Nov 24, 2020
1 parent 4c6009d commit 005c261
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 0 additions & 1 deletion packages/compiler-core/src/ast.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { isString } from '@vue/shared'
import { ForParseResult } from './transforms/vFor'

import {
Expand Down
9 changes: 4 additions & 5 deletions packages/compiler-core/src/parse.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { NO, extend, isArray } from '@vue/shared'
import { assert } from 'console'
import {
RootNode,
Namespaces,
Expand All @@ -13,7 +12,7 @@ import {
} from './ast'
import { defaultOnError } from './errors'
import { ParserOptions } from './options'
import { advancePositionWithMutation } from './utils'
import { advancePositionWithMutation, assert } from './utils'

type OptionalOptions = 'isNativeTag' | 'isBuiltInComponent'
type MergedParserOptions = Omit<Required<ParserOptions>, OptionalOptions> &
Expand Down Expand Up @@ -99,14 +98,14 @@ function parseChildren(
mode: TextModes,
ancestors: ElementNode[]
): TemplateChildNode[] {
const parent = last(ancestors)
const ns = parent ? parent.ns : Namespaces.HTML
// const parent = last(ancestors)
// const ns = parent ? parent.ns : Namespaces.HTML
const nodes: TemplateChildNode[] = []

// TODO while is end
while (!isEnd(context, mode, ancestors)) {
__TEST__ && assert(context.source.length > 0)
const s = context.source
// const s = context.source
let node: TemplateChildNode | TemplateChildNode[] | undefined = undefined

if (mode === TextModes.DATA || mode === TextModes.RCDATA) {
Expand Down
7 changes: 7 additions & 0 deletions packages/compiler-core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,10 @@ export function advancePositionWithMutation(

return pos
}

export function assert(condition: boolean, msg?: string) {
/* istanbul ignore if */
if (!condition) {
throw new Error(msg || `unexpected compiler condition`)
}
}

0 comments on commit 005c261

Please sign in to comment.