MCPcopy Create free account
hub / github.com/mozilla/rhino / recordLabel

Method recordLabel

rhino/src/main/java/org/mozilla/javascript/Parser.java:2384–2403  ·  view source on GitHub ↗
(Label label, LabeledStatement bundle)

Source from the content-addressed store, hash-verified

2382 }
2383
2384 private void recordLabel(Label label, LabeledStatement bundle) throws IOException {
2385 // current token should be colon that primaryExpr left untouched
2386 if (peekToken() != Token.COLON) codeBug();
2387 consumeToken();
2388 String name = label.getName();
2389 if (labelSet == null) {
2390 labelSet = new HashMap<>();
2391 } else {
2392 LabeledStatement ls = labelSet.get(name);
2393 if (ls != null) {
2394 if (compilerEnv.isIdeMode()) {
2395 Label dup = ls.getLabelByName(name);
2396 reportError("msg.dup.label", dup.getAbsolutePosition(), dup.getLength());
2397 }
2398 reportError("msg.dup.label", label.getPosition(), label.getLength());
2399 }
2400 }
2401 bundle.addLabel(label);
2402 labelSet.put(name, bundle);
2403 }
2404
2405 /**
2406 * Found a name in a statement context. If it's a label, we gather up any following labels and

Callers 1

nameOrLabelMethod · 0.95

Calls 13

peekTokenMethod · 0.95
codeBugMethod · 0.95
consumeTokenMethod · 0.95
getLabelByNameMethod · 0.95
reportErrorMethod · 0.95
isIdeModeMethod · 0.80
addLabelMethod · 0.80
getNameMethod · 0.65
getMethod · 0.65
getLengthMethod · 0.65
getPositionMethod · 0.65
putMethod · 0.65

Tested by

no test coverage detected